Show structure of ref cursor


declare
l_rcursor sys_refcursor;
l_colCnt number;
l_descTbl dbms_sql.desc_tab;
begin
open l_rcursor for select * from all_users;

dbms_sql.describe_columns
( c       => dbms_sql.to_cursor_number(l_rcursor),
col_cnt => l_colCnt,
desc_t  => l_descTbl );

for i in 1 .. l_colCnt
loop
dbms_output.put_line( l_descTbl(i).col_name );
end loop;

end;

Leave a Reply

Your email address will not be published. Required fields are marked *