Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Creating Collection Dynamically

user8879206Jun 25 2012 — edited Jun 26 2012
Hi Guys,

Is there any way to create the PL SQL table dynamically?

For Example:

create procedure p_load_data(i_table_name varchar2,i_ret_string out varchar2)
is
type my_type is table of i_table_name%rowtype index by pls integer;

mt my_type;

begin

Select * bulk collect into mt limit 20000;

forall i in 1..mt.count
insert into fact values (i);

commit;

-- code for loading data

end;
/

The above proc is used for loading data for 10 different table with different structures. So I was trying to implement the generic proc throught which it could be loaded.

Is there any way through which we can create type dynamically as given below, if not what is the best of implementing it?

type my_type is table of i_table_name%rowtype index by pls integer;

Thanks
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 24 2012
Added on Jun 25 2012
8 comments
1,363 views