How to loop through columns in an oracle pl/sql cursor.

Posted by Lloyd on Stack Overflow See other posts from Stack Overflow or by Lloyd
Published on 2010-04-09T14:58:23Z Indexed on 2010/04/09 15:03 UTC
Read the original article Hit count: 503

Filed under:
|

I am creating a dynamic cursor and I would like to loop over the columns that exist in the cursor. How would I do that?

For example:

create or replace procedure dynamic_cursor(empid in varchar2, RC IN OUT sys_refcursor) as
     stmt varchar2(100);
   begin
     stmt := 'select * from employees where id = ' || empid;
     open crs for stmt using val;

     for each {{COLUMN OR SOMETHING}}
       --TODO: Get this to work
     loop;
end;     

© Stack Overflow or respective owner

Related posts about Oracle

Related posts about plsql