plsql - Oracle, Execute immediate Insert -


i'm trying insert random generating data table, here's code"

begin   x in 1..300 loop     execute immediate 'insert emp values ('||prac_seq.nextval||','''||'name'||x||''','||trunc(dbms_random.value(1,300))||');';   end loop; / 

table emp has 3 columns - id,name,idmgr;

above query in execute immediate statement looks like:

insert emp values (13,'name25',193); 

this block did not run. when tried run single execute immediate statement (f.e.

begin   execute immediate 'insert emp values ('||prac_seq.nextval||','''||'name23'','||trunc(dbms_random.value(1,300))||');' end;     / 

ora gives me error:

execute immediate 'insert emp values ('||prac_seq.nextval||','''||'name23'','||trunc(dbms_random.value(1,300))||');'; end; error report: ora-00911: invalid character ora-06512: @ line 3 00911. 00000 - "invalid character" *cause: identifiers may not start ascii character other letters , numbers. $#_ allowed after first character. identifiers enclosed doublequotes may contain character other doublequote. alternative quotes (q'#...#') cannot use spaces, tabs, or carriage returns delimiters. other contexts, consult sql language reference manual. *action:

and why? commas, quotes.. checked , fine.

try remove ; dynamic query.


Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -