Compile time error when second parameter of an overloaded procedure is null
Posted on 2008-10-07
I have a package MSG_DLM_PROCESS.
It has 2 procedures (p_process) overloaded in MSG_DLM_PROCESS package.
The p_process differs in the second parameter p_ctxt_in.
In first procedure p_ctxt_in is of type MSG_BE.t_gtx_ctxt
In second procedure p_ctxt_in is of type MSG_BE.t_atd_ctxt
I create a test case to test p_process procedure with second parameter as null.
I call p_process procedure with the second parameter p_ctx_in as null;
I get the error:
Error(112,5): PLS-00307: too many declarations of 'P_PROCESS' match this call
obviously, oracle is not able to decide which overloaded procedure to call in the package.
Q) Now in such scenario, I need to terminate the procedure with an exception raised and handled in the
calling procedure. Just like i get an exception raised if the first parameter of p_process is null.
WHEN OTHERS THEN
dbms_output.put_line('Test Case 3 FAILED - ' || sqlcode ||' : '||sqlerrm);
Instead of a runtime error, this case becomes compile time error and the test procedure p_test_case_3_gtx itself
How do I handle this?