Populating a temporary table from the result of a stored procedure in Pl-sql
===

I have a stored procedure (proc A) that returns a ref cursor. I want another stored procedure (proc B) to call this one and store the results in another table (i.e inside proc B). A simplified version of the problem (not using any procs) is given below. The syntax below does not compile.

        create table vtest1 (a number, b number); 
        create table temptable1(a number, b number); 
        declare 
        pOUT SYS_REFCURSOR;
        type vtest1Tab is table of vtest1%rowtype;
        begin
          open pOUT for 'select * from vtest1';
          insert into temptable1(n1,n2)  
          select * from TABLE( cast(pOUT as vtest1Tab));
          close pOUT;
        end;    

Thanks.