Using/Calling a cursor in another cursor - PL/Sql

Posted by Cindy on Stack Overflow See other posts from Stack Overflow or by Cindy
Published on 2011-11-14T16:23:21Z Indexed on 2014/05/29 21:28 UTC
Read the original article Hit count: 446

Filed under:
|
|

I have a function with a cursor which returns an ID. I need to get some fields in another cursor using this ID result from the first cursor.

So my first cursor is:

CREATE OR REPLACE function get_id(id number) 

CURSOR child_id
   IS
       SELECT table1_id
            FROM table1,child
              WHERE child_id = id
          AND table1_id = child_chld_id;

Ideally my second cursor should be:

cursor grandchild_id
is
select table1_id from table1,child
where child_id = (return value of id from cursor child_id)
and table1_id = child_chld_id; 

How do I do this?

© Stack Overflow or respective owner

Related posts about function

Related posts about plsql