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!

Pass variable name in insert clause

FirstName_LastNameNov 20 2015 — edited Nov 20 2015

I have a nested table variable that holds all the column names of a table. I am trying to get the data into the record dynamically and pass it to an insert statement.

For example -

DECLARE


v_table is table of varchar2(100);

BEGIN

--This v_table has all the column names of a particular table.

FOR I in 1..v_table.count

loop

INSERT INTO emp1(v_table(I)) values(123);

end loop;

END;

Apparently I am unable to pass the v_table(I) in the column list of insert command. Is there a way to pass the column names dynamically ?

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 18 2015
Added on Nov 20 2015
6 comments
3,209 views