Re: Processing different cursor types with the same procedure/function
Date: 13 Aug 2002 14:41:59 -0700
Message-ID: <42ffa8fa.0208131341.60919fef_at_posting.google.com>
Well, there is a "cursor based record type" you can use. Hopefully this would do it for you. In the following example, I use "cursor based record type" to store records returned from a different cursor. As long as the cursors have the same structure, it does not really matter.
SQL> desc test2
Name Null? Type ----------------------------------------- --------
----------------------------
C1 VARCHAR2(2) C2 NUMBER(1) SQL> desc test3 Name Null? Type ----------------------------------------- --------
----------------------------
C1 NOT NULL VARCHAR2(2) C2 NUMBER(1)
SQL> declare
2 cursor cur1 is select * from test2;
3 cursor cur2 is select t2.c1, t3.c2 from test2 t2, test3 t3 where
t2.c1=t3.c1 and t2.c2=t3.c2;
4 procedure proc1(recin cur2%rowtype) is
5 begin
6 dbms_output.put_line('c1 := '||recin.c1||' , c2 := '||recin.c2);
7 end;
8 begin
9 for x in cur1 loop
10 proc1(x);
11 end loop;
12 end;
13 /
c1 := a , c2 := 1 c1 := b , c2 := 2 c1 := c , c2 := 3 c1 := e , c2 := 1 c1 := a , c2 := 4 c1 := a , c2 := 5 c1 := a , c2 := 6 c1 := a , c2 := 7 c1 := a , c2 := 6 c1 := a , c2 := 7
PL/SQL procedure successfully completed.
SQL> Received on Tue Aug 13 2002 - 23:41:59 CEST