Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: how to achieve autoincremented PKs (as datatype SERIAL does)
"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