Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Why Oracle don't have AUTO_INCREMENT as in MySQL
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 Received on Mon Apr 23 2007 - 19:37:09 CDT