+ 12
How to return more than one value in pl/sql functions? Give some example?
7 Antworten
+ 3
Rosy... nice one but make it clean... it's quite unreadable for beginners...
+ 3
I think Ericka pretty much answered this, but to clarify:
it is possible to return multiple values which are dependent on the function parameter
this is to say, you cannot add extra parameters into a function and expect to be able to output separate tests for each of them.
its like performing a lab experiment and picking too many variables to test a hypothesis, the science will not work!
+ 2
i always thought that returning a row, column or table of values was essentially outputting more than one result? or would the entire table in question be counted as a single unit, similar to an array?
+ 2
a table IS an array.
Perhaps you want to test all brands of cars (x) for the color fireengine-red (y). You would expect the independent y to change but not dependent x. For each brand, Subaru, Chevy... you can return “true” or “false”. Therefore, you are still outputing a single test output.
In the real world we are going to expect variations of “red”, but thats besides the point.
+ 1
Yeah...
0
IF sales_cur%NOTFOUND
THEN
CLOSE sales_cur;
RETURN NULL;
ELSE
CLOSE sales_cur;
RETURN [B]return_value1, return_value2[/B];
END IF;
I know the above code will not work, but just to demonstrate, is it possible to return two values with a function.