Re: HELP: How to generate sequential Primary Keys on a master-detail form?

From: Thomas Kyte <tkyte_at_oracle.com>
Date: 6 Apr 2002 08:44:06 -0800
Message-ID: <a8n8km0f4n_at_drn.newsguy.com>


[Quoted] In article <6asrau4lfelqqtptocr3h3hqbt1ccdncth_at_4ax.com>, Sybrand says...
>
>On Mon, 01 Apr 2002 16:09:51 GMT, IF <tlfbi98_at_terra.es> wrote:
>
>>We have a master-detail form and we need to generate sequential
>>primary keys values for the records of the master block just before
>>inserting them into the database.
>>
>>We cannot use Oracle Sequences because we cannot lose any value in the
>>sequence. Therefore, in order to generate the sequential values for
>>the primary key, we have to use a value stored in another table.
>
>rubbish. Create sequence ... nocache ordered.
>

[Quoted] until you rollback -- then you have a gap. If you use sequences, you will have a gap -- 100% probability.

I agree with the "rubbish" part however -- the rubbish part is the supposed technical need for gap free sequential numbers which seems to be a hold over from the days when you had a 100% paper based system and a person physically assigned document numbers or such one a time. gap free sequential numbers just *don't scale* -- the imply and enforce serialization.

>Regards
>
>
>Sybrand Bakker, Senior Oracle DBA
>
>To reply remove -verwijderdit from my e-mail address

--
Thomas Kyte (tkyte_at_us.oracle.com)             http://asktom.oracle.com/ 
Expert one on one Oracle, programming techniques and solutions for Oracle.
http://www.amazon.com/exec/obidos/ASIN/1861004826/  
Opinions are mine and do not necessarily reflect those of Oracle Corp 
Received on Sat Apr 06 2002 - 18:44:06 CEST

Original text of this message