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: foocounter.CURRVAL

Re: foocounter.CURRVAL

From: Brian Peasland <peasland_at_usgs.gov>
Date: Fri, 16 Mar 2001 14:14:40 GMT
Message-ID: <3AB21FD0.509656BF@usgs.gov>

> But using just foocounter.CURRVAL after the first INSERT might lead to
> concurrency problems, e.g. if someone else incremented the counter
> exactly in-between my two INSERTs.

Yes, it will. So if you want to make sure that the value you inserted is the same as the value you use later in your PL/SQL block, you have to read it into a variable as others have suggested.

Another way to do this is to create a trigger that is fired after inserting the record into the table. In the trigger, you can capture the pk fields and process them how you want. Personally, I'd use the other method suggested in this thread, but I'm just throwing this out there as an option.

HTH,
Brian

-- 
========================================
Brian Peasland
Raytheons Systems at
  USGS EROS Data Center
These opinions are my own and do not
necessarily reflect the opinions of my 
company!
========================================
Received on Fri Mar 16 2001 - 08:14:40 CST

Original text of this message

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