to insert values dynamically into the dynamic table
593275Jan 11 2008 — edited Jan 14 2008Hi All,
I have created one procedure which creates table structure dynamically i.e if client pass the No. of columns from front end then based on that table will be created in database dynamically through procedure.I have done succesfully this.
Now I am stuck in inserting values in the table dynamically. I have written procedure for that.. But i m getting error.Below is the code.Please help me out in solving this problem ...
q:='''insert into '||table_name||'(';
for i in 1..v_column loop
q:=q||'col'||i||',';
end loop;
q:=q||'aaa';
q:=replace(q,',aaa',')');
q:=q||' values (';
for i in 1..v_column loop
q:=q||':'||i||',';
end loop;
--dbms_output.put_line (q);
q:=q||'exppp';
q:=replace(q,',exppp','')||')''';
q:=q || chr(13) || ' USING ';
for i in 1..v_column loop
q:=q|| chr(13) || ' v_data_array '||'('||i||')'',''';
end loop;
q:=q||'zzzzz';
q:=replace(q,',zzzzz',' ; ');
execute immediate q;
It would be very helpful to me if i get solution for this problem. Thanks in advance.
Regards
Dhan