Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: How to retrive Deleted Sequence Number????
Holger Baer wrote:
> Serge Rielau wrote:
>
>> Two words: CONNECT BY >> (footed on DUAL as a row producer) >> >> Cheers >> Serge
Here is what I would write in ANSI SQL.
I'm sure it's easy for an Oracle person to translate to CONNECT BY:
WITH rec(seqno) AS (SELECT MIN(seqno) -1 FROM SampleTable
UNION ALL SELECT seqno - 1 FROM rec WHERE seqno > 1)SELECT seqno FROM rec;
Assume existing sequence numbers are sparse: WITH rec(seqno) AS (SELECT 1 FROM DUAL
UNION ALL SELECT seqno + 1 FROM rec WHERE seqno < (SELECT MAX(seqno) FROM SampleTable))SELECT seqno FROM rec
Something like that....
Serge
Received on Wed Nov 03 2004 - 07:23:16 CST
![]() |
![]() |