What is the difference between PL-SQL Cursors and Tables? I'd like to use a PL-SQL procedure that returns the result from a couple of queries. However, it is not working w/ using an out variable of ref cursor type.
type cv is ref cursor;
procedure open_cursor (curs_text in varchar2, inner_curs in out cv) is
open inner_curs for curs_text;
open_cursor('select table_name from user_tables', outer_curs);
fetch outer_curs into tab_name;
if outer_curs%notfound then
If your selecting a table w/ your SQL statement, doesn't tab_name have to be of table type? It seems all your doing is just printing out table names. I wanted to return the result from a query, not just use a cursor to iteratively loop through each row, and print it to server output.
OK, you can have tab_name as user_tables.table_name%TYPE if you prefer. It doesn't make a lot of difference to the functioning of the procedure.
I don't understand what you mean by "returns the result from a query". The procedure I wrote is returning a result set in the form of an open cursor, which can then be manipulated by the calling program. What exactly do you want to be able to do ?
Click Here to Expand Forum to Full Width