Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Why Oracle don't have AUTO_INCREMENT as in MySQL

Re: Why Oracle don't have AUTO_INCREMENT as in MySQL

From: DA Morgan <damorgan_at_psoug.org>
Date: Mon, 23 Apr 2007 20:08:42 -0700
Message-ID: <1177384121.431131@bubbleator.drizzle.com>


Malcolm Dew-Jones wrote:
> DA Morgan (damorgan_at_psoug.org) wrote:
> : Galen Boyer wrote:
>
> : >> The Oracle sequence is a far more intelligent way to solve the
> : >> problem.
> : >
> : > The Oracle sequence is a far more powerful object that can be used to
> : > mimic autoincrementing keys. But that doesn't make it easier to
> : > implement for the developers.
>
> : If a developer can't handle
>
> : INSERT INTO t
> : (idcol)
> : VALUES
> : (idseq.NEXTVAL);
>
> : Then they should learn to say 'do you want fries with that'.
>
> : I hate to be a bit harsh here but it isn't exactly like asking
> : them to step up to a real hardship like curly braces or assembler.
>
> All true, but never the less the typical programmer error will be
> something like
>
> INSERT INTO tablexyz
> (idcol)
> VALUES
> (sequencexy.NEXTVAL)
>
> which will likely work for while, but later cause a mysterious bug that
> takes an hour to track down and fix.
>
> it would be nice to be able to say something like
>
> create table xyz
> ( idcol default eval('sequencexyz.NEXTVAL')
> );
>
> ,,, sort of a kind of declarative trigger.
>
> $0.10

Well Ok. I'll but it the way you wrote it. But to be honest I have never once, in more than a decade of Oracle, ever seen anyone choose the wrong sequence.

I've a seen a lot of other issues. But not that one.

-- 
Daniel A. Morgan
University of Washington
damorgan_at_x.washington.edu
(replace x with u to respond)
Puget Sound Oracle Users Group
www.psoug.org
Received on Mon Apr 23 2007 - 22:08:42 CDT

Original text of this message

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