Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Optional output cursor as parameter

I'm trying to cater for two applications.

One calls a procedure with 2 cursors, the other with 1.

Both are OUT SYS_REFCURSOR.

Because of the difference in definition of the procedure, the change to one application will break the other.

I am wondering if its possible to have the same procedure with both OUT SYS_REFCURSOR but with the second parameter as optional. This is done in other parts of the project by defining a default value.

I have tried googling and defining default values but to no avail. This doesnt seem to be a very common issue.

Is there a way to have this definition with an optional OUT SYS_REFCURSOR ?

Here is my code:

PROCEDURE Proc_GetQ (qList OUT SYS_REFCURSOR, qStack OUT SYS_REFCURSOR);

I would like qStack to be optional.

Thanks, JFIT

like image 503
JF it Avatar asked Apr 27 '26 13:04

JF it


1 Answers

What about method overloading?

PROCEDURE Proc_GetQ (qList OUT SYS_REFCURSOR, qStack OUT SYS_REFCURSOR);
PROCEDURE Proc_GetQ (qList OUT SYS_REFCURSOR);

Create a procedure with the same name, similar logic (better call 2-parameter version inside and pass only one outside), but only one OUT parameter.

like image 79
miracle_the_V Avatar answered Apr 30 '26 10:04

miracle_the_V



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!