Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Re: Automatic sequential record numbering?
Jon S wrote:
>
> Hi,
>
> I'm new to Oracle and I was wondering what the best method is for
> automatically generating a new sequential number for each record inserted in
> a table. For instance, I have a table that holds problem reports. Each
> report needs a unique identifier and should be sequential (i.e. the first
> one would be report #1, the second would be report #2, etc.) Also, I would
> like the numbers to not have any gaps in them so that I can keep track of
> each problem report. I'm currently using a sequence to accomplish this, but
> I was wondering if there was a better method.
>
> This application runs on WinNT 4.0 server as an IIS app with Oracle 8i.
>
> Thanks,
> Jon
A (well cached) sequence (say on a before-row trigger) would probably give the best performance.
Try veer away from the "must be contiguous" requirement - it causes problems.
HTH
-- =========================================== Connor McDonald http://www.oracledba.co.uk We are born naked, wet and hungry...then things get worseReceived on Sun Aug 13 2000 - 00:00:00 CDT
![]() |
![]() |