Reputation: 1791
I am studying about oracle sql
I am trying to create dynamic table and i would like to insert some values into dynamic table ( "s" is the variable name)
i was trying to use...
execute immediate 'INSERT INTO t'||tbcounter||'(column1, column2) VALUES (s, s)';
however, i am getting error
ORA-00926: missing VALUES keyword
I am guessing there is syntax error..
but i am not really sure the error in the code..
does anyone know the error in the code ?
thanks
EDIT:
I just fixed problem. Inserting should be
sql_stmt := 'INSERT INTO t'||tbcounter||' VALUES (:1, :2)';
EXECUTE IMMEDIATE sql_stmt USING s, s;
Upvotes: 1
Views: 2823
Reputation: 3777
Try with this:
execute immediate 'INSERT INTO t'||tbcounter||' (column1, column2) VALUES (' || s || ' , ' s || ' )' ;
IS tbcounter is table name .
Upvotes: 1