Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Finding next number in custom sequence

Re: Finding next number in custom sequence

From: FC <flavio_at_tin.it>
Date: Tue, 07 May 2002 20:55:30 GMT
Message-ID: <6bXB8.15964$CN3.536247@news2.tin.it>


select nvl(mod(max(seq_num) + 1, 2048), 0) from your_table  where mod(seq_num + 1, 2048) not in (select seq_num from your_table)  and destination = 'something'

...I believe

"compboy" <compboy80_at_hotmail_spam.com> wrote in message news:udgdqs8f025c21_at_corp.supernews.com...
> I can begin the seq_num at 0 what would it be then?
>
> Thanks
>
> "FC" <flavio_at_tin.it> wrote in message
> news:2bWB8.13638$zW3.322530_at_news1.tin.it...
> > select greatest(nvl(mod(max(seq_num) + 1, 2048), 0), 1) from your_table
> > where greatest(mod(seq_num + 1, 2048), 1) not in (select seq_num from
> > your_table)
> > and destination = 'something'
> >
> > If you had begun the sequence with 0, it would have been easier :-)
> >
> >
> > Bye,
> > Flavio
> >
> >
>
>
Received on Tue May 07 2002 - 15:55:30 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US