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

Home -> Community -> Usenet -> c.d.o.misc -> Re: How to get the ID of the last inserted row

Re: How to get the ID of the last inserted row

From: Daniel Morgan <damorgan_at_x.washington.edu>
Date: Tue, 30 Sep 2003 22:01:43 -0700
Message-ID: <1064984504.814248@yasure>


Richard Kuhler wrote:

> Daniel Morgan wrote:
> <snip>
>
>>> I was referring to the possibility that a trigger could select
>>> another value from the sequence between the time the value for the
>>> insert is selected and your currval select. In that situation you
>>> won't get the value you're probably expecting.
>>>
>>>
>>> Richard Kuhler
>>>
>> Of course you will. You always get back the last value from your own
>> session. Oracle is not a single-user database.
>
>
> I guess I should have been clearer there. I'm referring to a trigger
> firing IN THE SAME SESSION that may use the sequence a second time
> within the duration of what the application perceives to be a single
> insert.
>
>
> Richard Kuhler

Then it will use CURRVAL. I still don't see any issue. The behavior of a sequence, of CURRVAL and NEXTVAL are 100% documented and predictable. Have been for years. Read the documentation and they do exactly what they are supposed to do. So what can go wrong short of making a call to DBMS_RANDOM by mistake?

-- 
Daniel Morgan
http://www.outreach.washington.edu/ext/certificates/oad/oad_crs.asp
http://www.outreach.washington.edu/ext/certificates/aoa/aoa_crs.asp
damorgan_at_x.washington.edu
(replace 'x' with a 'u' to reply)
Received on Wed Oct 01 2003 - 00:01:43 CDT

Original text of this message

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