Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: Does Oracle Allow Retrieval of Parsed Insert Statement??
Hi, Sam,
To get the rowid of the inserted row, look at Case 1 of http://osi.oracle.com/~tkyte/Mutate/index.html.
I'm not sure how you can view parsed SQL statement. You mean the compiled SQL? The closest you can get is v$sqlarea.sql_text.
It's not a good idea to have a table without the primary key. If you do have it, such as EMPID for the EMP table and EMPID is provided by a sequence on firing a trigger, you can use this SQL to get it:
insert into EMP (name) values ('John') returning EMPID into myPLSQLvar;
Yong Huang
yong321_at_yahoo.com
you wrote:
We have a situation where we insert rows into a table, without having knowledge of the primary key. One of our developers needs to determine the rowid of such a row (primary key unknown) immediately after the row is inserted into the table.
Does anybody know if the rowid can be retrieved (or somehow returned) immediately after the row is inserted (without requerying the table)?
The rowid can also be determined by parsing the insert statement, retrieving the primary key, then querying the table for the rowid of the row. Does anybody know if Oracle has an OCI call that returns components of a parsed SQL INSERT statement. Or does anybody have a script or procedure that parses a SQL INSERT statement?
Thanks for any help.
Sam.
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 01 2001 - 11:49:18 CST