Path: newssvr20.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!news.linkpendium.com!news-out.visi.com!petbe.visi.com!newsfeed2.dallas1.level3.net!news.level3.com!postnews1.google.com!not-for-mail
From: Mark.Powell@eds.com (Mark D Powell)
Newsgroups: comp.databases.oracle.server
Subject: Re: forcing the developers to use sequences
Date: 12 Dec 2003 13:41:44 -0800
Organization: http://groups.google.com
Lines: 24
Message-ID: <2687bb95.0312121341.5221a37f@posting.google.com>
References: <qwlCb.402$Er.31529@mencken.net.nih.gov>
NNTP-Posting-Host: 192.85.50.2
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
X-Trace: posting.google.com 1071265305 6128 127.0.0.1 (12 Dec 2003 21:41:45 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Fri, 12 Dec 2003 21:41:45 +0000 (UTC)
Xref: newssvr20.news.prodigy.com comp.databases.oracle.server:250022

"Gordon T. Wu" <wutao19@yahoo.com> wrote in message news:<qwlCb.402$Er.31529@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 --
