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: forcing the developers to use sequences

Re: forcing the developers to use sequences

From: Phil <phil_at_nospamthanks.com>
Date: Fri, 12 Dec 2003 12:06:09 -0500
Message-ID: <ppadncc_Rr4caESi4p2dnA@golden.net>


Syltrem wrote:

> You can create a trigger AFTER INSERT on the table.
> This way, any value set by a program can be overridden by the trigger.
> That`s the best way to do it but it does not remove the need to educate
> programmers...
>

The problem with using a trigger to populate the column is that it doesn't educate the programmers as what the proper solution is, as you have indicated.

The other problem with a trigger is that for those programmers that do use the sequence to populate the table, you have needless gaps in the numbers generated, which isn't a big deal, just avoidable.

A unique index on the column may help because the client program will fail when a duplicate value is attempted to be inserted or updated, which is a real probability with programmers not using the sequence to populate the column. This puts the onus on them to fix their program to use the sequence.

HTH Phil Received on Fri Dec 12 2003 - 11:06:09 CST

Original text of this message

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