Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need to to create a Global Temp table while using a Cursor

Status
Not open for further replies.

Frenchfry

Programmer
Dec 26, 2011
3
US
Hello,

I am using a Procedure, using a Cursor within and now I need to create a Global Temp table.

Can someone provide a example of the use of all three.

Thanks in Advance
 
Code:
create global temporary table FF (x number)
       on commit preserve rows;

Table created.

create or replace procedure FrenchFry is
begin
    for x in (select salary from s_emp) loop
        insert into FF values (x.salary);
    end loop;
    commit;
end;
/

Procedure created.

execute FrenchFry

PL/SQL procedure successfully completed.

select * from ff;

         X
----------
      3000
      1450
      2000
      1450
      1550
      1200
      1250
      1100
      1300
      1307
      1400
      1490
      1515
      1525
      1450
      1400
       940
      1200
       795
       750
       850
       800
       795
       860
      1100

25 rows selected.
Let us know if this is what you wanted.

[santa]Mufasa
(aka Dave of Sandy, Utah, USA)
“People may forget what you say, but they will never forget how you made them feel.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top