Re: How to create a sequence with a dynamic start value

From: <madhusreeram_at_gmail.com>
Date: Sun, 15 Jun 2008 17:37:25 -0700 (PDT)
Message-ID: <43817c1f-937c-4bf7-b420-d812e248f293@c65g2000hsa.googlegroups.com>


On Jun 12, 2:17 am, Norbert Pürringer <thalio..._at_graffiti.net> wrote:
> Hello,
>
> what is the best way to create a sequence with a dynamic start value.
>
> The following statement is not valid:
>
> create sequence TEXT_SEQ start with select NVL(max(ID),0) + 1 from
> TEXT;
>
> Thank you,
> Norbert

One of the way, using sqlplus , generate a script file & execute it :

spool seq.ddl
select 'create sequence text_seq start with' || nvl(max(id),0) +1 ||';' from text;
spoo off
@seq.ddl

-Madhu Sreeram Received on Sun Jun 15 2008 - 19:37:25 CDT

Original text of this message