Home » SQL & PL/SQL » SQL & PL/SQL » how do i create a plsql type ..like table
how do i create a plsql type ..like table [message #37531] Wed, 13 February 2002 07:20 Go to next message
ksr
Messages: 112
Registered: January 2002
Senior Member
how to create a "type like table"

Hi,
I have few questions

1) How to create a type of table(or like table)
something like
type cur1 is table of tab1;

2) How do i assign the data to this type which is a selection of records from another select statement

like...

select * from tab2 bulk collect into cur1; ---something like this

3) How do i read all the columns in a loop from this type of table

like..once i assign the values to the type cur1,
how to read the values and columns in a loop..

forall cur1.first..cur1.last
insert into table3 values(cur1(col1),cur1(col2)----something like this

Any example will be useful..

any help is appreciated
Re: how do i create a plsql type ..like table [message #37578 is a reply to message #37531] Thu, 14 February 2002 12:29 Go to previous message
Suresh Vemulapalli
Messages: 624
Registered: August 2000
Senior Member
at present, bulk collect into record rowtype pl/sql tables is not allowed . you have to populate one by one record or declare different pl/sql tables for each column and use bulk collect into clause.

ex:

declare
type tab1 is table of col1%type index by binary_integer;
type tab2 is table of col2%type index by binary_integer;
t1 tab1;
t2 tab2;
cursor c1 is select col1,col2 from tab1;
begin
open c1;
fetch c1 bulk collect into t1,t2;
close c1;
...

end;
Previous Topic: How to schedule a job at a certain time?
Next Topic: sql stament with data functions
Goto Forum:
  


Current Time: Thu Sep 23 13:02:46 CDT 2021