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: how to achieve autoincremented PKs (as datatype SERIAL does)

Re: how to achieve autoincremented PKs (as datatype SERIAL does)

From: Greg Akins <greg.akins_at_alcoa.com>
Date: Thu, 27 Feb 2003 07:56:28 -0500
Message-ID: <b3l1sb$sl89@ncsftp.dana.com>

"Frank Ratzlow" <frank_ratzlow_at_hotmail.com> wrote in message news:5ef29569.0302270357.1adad160_at_posting.google.com...
> Hallo folks,
>
> is it possible to put the handling of autogenerating PK to Oracle? I
> think to remember from Informix the datatype SERIAL that makes it
> quite easy as I don't have to determine a new value for the key.
> I just would like to insert a row without having to know or
> (calculate) the value of the new record.
> For a short time I thought of:
>
> ============
> INSERT INTO customer (customerid, firstname, lastname) VALUES ((SELECT
> MAX(customerid) FROM customer) + 1, 'Sven', 'Grundmann');
> ============

Look up SEQUENCES Received on Thu Feb 27 2003 - 06:56:28 CST

Original text of this message

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