Can an Oracle SQL procedure return a table? I’m currently using a dbms_output to print out the outputs of two cursors which are in a loop, although this would look nicer if it was returning two columns instead. Would that be possible within a procedure?
Can an Oracle SQL procedure return a table? I’m currently using a dbms_output to
Share
A PL/SQL function can return a nested table. Provided we declare the nested table as a SQL type we can use it as the source of a query, using the the TABLE() function.
Here is a type, and a nested table built from it:
Here is a function which returns that nested table …
… and this is how it works:
SQL Types offer us a great deal of functionality, and allow us to build quite sophisticated APIs in PL/SQL. Find out more.