Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: foocounter.CURRVAL
> 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
![]() |
![]() |