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: HOW TO SELECT LATEST INSERTED ROW..

RE: HOW TO SELECT LATEST INSERTED ROW..

From: William Beilstein <BeilstWH_at_obg.com>
Date: Thu, 22 Feb 2001 06:28:02 -0800
Message-ID: <F001.002BA7C3.20010222054525@fatcity.com>

Remember the rowid is a storage location and Oracle does not return the rows in the order that they were inserted. The only way to get the most recently inserted row is to have a column that is populated with a sequence (maybe from a trigger) where you select the largest value.

>>> "Jamadagni, Rajendra" <rajendra.jamadagni_at_espn.com> 02/22/01 08:20AM >>>
Depending on DB version you are on, you can use "insert into ... values ... returning rowid into var_rowid" This will return the rowid of the latest inserted row in a local variable v_rowid. Using this, it will be easy to retrieve the row and proceed further with your processing.

I doubt this could be done in a trigger, but you need to test ..

HTH
Raj



Rajendra Jamadagni MIS, ESPN Inc. Rajendra dot Jamadagni at ESPN dot com
Any opinion expressed here is personal and doesn't reflect that of ESPN Inc.

QOTD: Any clod can have facts, but having an opinion is an art !


This e-mail message is confidential, intended only for the named recipient(s) above and may contain information that is privileged, attorney work product or exempt from disclosure under applicable law. If you have received this message in error, or are not the named recipient(s), please immediately notify ESPN at (860) 766-2000 and delete this e-mail message from your computer, Thank you.


-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com 
-- 
Author: Jamadagni, Rajendra
  INET: rajendra.jamadagni_at_espn.com 

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
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).

--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author: William Beilstein
  INET: BeilstWH_at_obg.com

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
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 Thu Feb 22 2001 - 08:28:02 CST

Original text of this message

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