Create procedure with variable of table and cols
880826Aug 18 2011 — edited Aug 19 2011Hi,
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