Click here to Skip to main content
15,891,597 members
Please Sign up or sign in to vote.
2.33/5 (3 votes)
See more:
i have one table. there are 6 columns.in that one column is auto generation.but i did't autogenerate. simply i have given sequence name.using function i have stored sequence name in one variable.how to refer sequence without using sequence name (ie) sequencename.nextval.. instead of that i should refer using variable (ie) variable.nextval... how to do
Posted
Comments
hanie2 5-Nov-13 7:42am    
it's ok

1 solution

hi use dynamic query like this:

declare
seqName varchar2(100);
seqVal number;
begin
execute immediate "select " || seqName || ".nextval from dual" into seqVal;
end ;
/
 
Share this answer
 
Comments
eivan1815 5-Nov-13 7:23am    
thank you ,
it was so useful
Member 10381235 5-Nov-13 7:24am    
very good
Reza Farhadi 5-Nov-13 7:32am    
thanks it is usefull
sahar khalilnejad 5-Nov-13 8:07am    
excellent

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900