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

Home -> Community -> Mailing Lists -> Oracle-L -> Re: Re[2]: How do you genrate primary keys?

Re: Re[2]: How do you genrate primary keys?

From: Nuno Souto <nsouto_at_optusnet.com.au>
Date: Thu, 06 Nov 2003 23:09:36 -0800
Message-ID: <F001.005D5DF0.20031106230936@fatcity.com>


Dangerous. The UPDATE is not the same as a SELECT with lock. It has a read component that won't lock and a write component that WILL lock at write time. That is not what you want.
Cheers
Nuno Souto
nsouto_at_optusnet.com.au
----- Original Message -----

> What about doing it in one step?
>
> Declare lCounter int;
> Begin
> UPDATE counter_table
> SET counter := counter+1
> WHERE counter_name = 'table name'
> RETURNING counter INTO lCounter;
> End;

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net
-- 
Author: Nuno Souto
  INET: nsouto_at_optusnet.com.au

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Fri Nov 07 2003 - 01:09:36 CST

Original text of this message

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