Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: dynamic value for sequence
Well now, maybe it's because I rubbed my magic lamp instead of my lucky
stone, but here's one way to do it ... depending on whether or not you
can pass an anonymous pl/sql block instead of a sql statement:
declare
starting_with varchar2(5) := 99;
begin
execute immediate 'create sequence xyz start with '||starting_with;
end;
/
select xyz.nextval from dual;
NEXTVAL
99
Martin Doherty wrote:
> Well, you can wish and wish and wish while rubbing your lucky stone, but it > doesn't change Oracle SQL syntax :). The START WITH clause will only accept an > integer constant, therefore you must determine the value of that integer and > then construct the CREATE SEQUENCE command accordingly. You will not be able to > accomplish what you want in a single statement. > > Martin Doherty > > "Ingo R. Kirchner" wrote: > >