Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: dynamic value for sequence
"Ingo R. Kirchner" wrote:
> Hi,
>
> I would like to create a sequence with a start value based on the maximal
> Value of the table
>
> something like
>
> create sequence software_seq
> start with (select max(softwareid) from software)+1
> increment by 1
> nomaxvalue;
>
> but it doesn't work this way
>
> any help appreciated, thanks in advance
>
> Ingo
SELECT MAX(column_name) FROM table;
CREATE SEQUENCE sequence_name START WITH <the number previously returned here>
unless you want to put it all together in code with dynamic SQL but I can't imagine why.
Daniel Morgan Received on Tue Sep 24 2002 - 11:10:34 CDT
![]() |
![]() |