Menu

utAssert.throws calling procedure with output parameter

spider122
2016-01-12
2016-01-13
  • spider122

    spider122 - 2016-01-12

    How do you call a utAssert statement against a procedure that contains an out parameter? I have the following:

    PROCEDURE ut_cashrelease_wrong_date IS
    last_datetime DATE;
    last_datetime2 DATE;
    BEGIN
    SELECT SYSDATE - INTERVAL '1' SECOND INTO last_datetime from dual;
    SELECT SYSDATE - INTERVAL '1' SECOND INTO last_datetime2 from dual;

    utAssert.throws('wrong date',
    'PKG_WEBSERVICES.pr_get_test2(''' || last_datetime || ''',last_datetime2);',
    -20104
    );
    END;

    This calls a proc with this syntax:
    PROCEDURE pr_get_test2 (
    p_business_datetime IN t_fund_curr_stat_mst.upd_t%TYPE,
    p_business_datetime2 OUT t_fund_curr_stat_mst.upd_t%TYPE
    );

    However, I'm getting the following error:
    PLS-00201: identifier 'LAST_DATETIME2' must be declared

    last_datetime2 is declared in the test, but I'm passing a string with this name. I don't want a value passed since it's an out parameter.

    In actuality, since I'm expecting to hit an exception, I really don't care what gets passed in, but I need to call the proc with that signature.

    Thanks.

     
  • spider122

    spider122 - 2016-01-13

    I was able to get this working by using this:

    utAssert.throws('wrong date',
    'declare last_datetime2 DATE;
    begin
    PKG_WEBSERVICES.pr_get_cashrelease(''' || last_datetime || ''',last_datetime2);
    end;',
    -20104
    );

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.