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: Rene Nyffenegger <rene.nyffenegger_at_gmx.ch>
Date: 27 Feb 2003 18:11:11 GMT
Message-ID: <b3lkbv$1ntfmi$2@ID-82536.news.dfncis.de>

> 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');
>============

See http://makeashorterlink.com/?Y33435A63

hth
Rene  

-- 
  no sig today
Received on Thu Feb 27 2003 - 12:11:11 CST

Original text of this message

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