Reputation: 623
I have a scenario where I have to return the pkId of the row which is inserted into the db recently. But i am afraid there is no straight way to achieve it in Oracle. Can any one tell any way to do it?
Upvotes: 1
Views: 329
Reputation: 332691
Assuming 10g+, use the RETURNING
clause:
INSERT INTO YOUR_TABLE
(columns...)
VALUES
(...)
RETURNING <expression> INTO <variables>
For more info, see:
Upvotes: 5