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!

How to pass a sequence by 'using' for execute immediate

DIVIJan 8 2013 — edited Jan 9 2013
how i can pass a sequence.nxlval as a parameter through using , here is my code looks like

sql_string is -> insert into some_tab (col1,col2, ....) (select col1,:passed_seq,......) where .... (i want to insert sequence values for col2)


and i am calling this as


passed_seq := 'seq_'||some_dynamic_num||'.nextval' ( in my db there will be sequences with the formed string like seq_10.nextval)

EXECUTE IMMEDIATE sql_string using passes_seq;

if i am doing like this i am getting

Error : -1722:ORA-01722: invalid number seq_10.nextval

Edited by: DIVI on Jan 8, 2013 7:40 AM
This post has been answered by unknown-7404 on Jan 8 2013
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 6 2013
Added on Jan 8 2013
8 comments
2,484 views