How to return more than one value in pl/sql functions? Give some example? | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
+ 12

How to return more than one value in pl/sql functions? Give some example?

23rd Jun 2018, 3:38 AM
Rama Chandran
Rama Chandran - avatar
6 Antworten
+ 3
Rosy... nice one but make it clean... it's quite unreadable for beginners...
26th Jun 2018, 9:44 PM
Silvanus Justice Silvanus
Silvanus Justice Silvanus - avatar
+ 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!
27th Jun 2018, 8:13 PM
Brandon Hehn
Brandon Hehn - avatar
+ 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?
27th Jun 2018, 11:27 PM
Mike Morley
Mike Morley - avatar
+ 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.
28th Jun 2018, 12:22 AM
Brandon Hehn
Brandon Hehn - avatar
+ 1
Yeah...
27th Jun 2018, 4:13 PM
BrinleeKearl__
BrinleeKearl__ - avatar
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.
27th Jun 2018, 4:52 PM
Ericka
Ericka - avatar