Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: Re[2]: How do you genrate primary keys?
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
![]() |
![]() |