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: Mark D Powell <Mark.Powell_at_eds.com>
Date: 12 Dec 2003 13:41:44 -0800
Message-ID: <2687bb95.0312121341.5221a37f@posting.google.com>


"Gordon T. Wu" <wutao19_at_yahoo.com> wrote in message news:<qwlCb.402$Er.31529_at_mencken.net.nih.gov>...
> In Oracle 9i2, is there a way to attach a sequence to a field so that people
> have to use the sequence during insertion operations?
>
> Say,
>
> create table test (id number(38), name varchar2(20);
> create sequence id_seq no cycle nomaxvalue;
>
> Is there a way to force the developers to use the sequence when inserting a
> new record?
> insert into test (id, name) values (id_seq.nextval, 'xyz');

If the developers include the column in their insert statement and supply a value there is no real way to enforce that the value supplied actually came from a sequence generator and not from some other source.

One option might be to supply the column value via a before insert trigger. But why would you need to force the developers to use a sequence generator? It would seem that this would be their chosen approach.

HTH -- Mark D Powell -- Received on Fri Dec 12 2003 - 15:41:44 CST

Original text of this message

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