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!

Create procedure with variable of table and cols

880826Aug 18 2011 — edited Aug 19 2011
Hi,

I am trying to develop procedure on 11gR2 like :
But I cannot compile that.

*****
create or replace procedure XXX(
p_table in string,
p_col in string
)
AS
type typetable is table of p_table%rowtype;
v_table typetable;
v_sql varchar2(32000);
begin
v_sql := 'select * bulk collect into'|| v_table ||'from'||p_table;
execute immediate v_sql;
if v_table.count > 0 then
for i in 1 .. v_table.count
dbms_output.put_line(v_table.p_col);
end loop;
end if;
end;
*****

the procedure is to get table name & column name as its parameter,
then use table type array to get it records.

for my program, i cannot use static table name and symbol.

Is anyone help or solve my prob ?



Regards,
Masah
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 16 2011
Added on Aug 18 2011
8 comments
289 views