Re: rowid of inserted row

From: Scott Urman <surman_at_oracle.com>
Date: 1995/05/23
Message-ID: <3ptn2e$mju_at_inet-nntp-gw-1.us.oracle.com>#1/1


In article <3pqig1$r4r_at_earth.usa.net>, surya_at_usa.net writes:
|> > hjelm+_at_cs.cmu.edu (Mark Hjelm) writes:
|> [DELETED]
|> is there a direct way to
|> > obtain the rowid of a row I've just inserted into a table? I can
|> > think of several indirect ways,
|> >
|> >>>>
|>
|> I don't know if the following satisfies 'DIRECT' criteria:
|>
|> 1. Have a package variable that gets populated in after insert trigger on row.
|> my_package.just_inserted_row_id := new.rowid
|> (Let me know if this works, please.)
|>
|> or
|>
|> 2. Query the table using the primary key of record just inserted and get the rowid.
|>
|> EXEC SQL SELECT rowid into :my_rowid ....
|>
|> Ganesh Puranik,
|> Consultant, Surya Systems, Inc.
|>

If you are inserting using OCI, the rowid of the inserted row can be found in the cursor data area immediately after the insert. Note that this won't work for scalar inserts. Received on Tue May 23 1995 - 00:00:00 CEST

Original text of this message