Home » SQL & PL/SQL » SQL & PL/SQL » How to get the primary key value from a new inserted record?
How to get the primary key value from a new inserted record? [message #2166] Tue, 25 June 2002 20:23 Go to next message
Hue
Messages: 1
Registered: June 2002
Junior Member
Hi,

Can anyone show me how do I get the value of the
primary key from a new inserted record in the parent table. I am trying insert two records in two tables
the parent and the child tables and don't have a clue
how to retrieve the value of the primary key from
the parent when inserting into the child table.

Thanks in advance
Hue
Re: How to get the primary key value from a new inserted record? [message #2311 is a reply to message #2166] Thu, 04 July 2002 18:16 Go to previous message
seng
Messages: 191
Registered: February 2002
Senior Member
it the sequence is used, the new primary key value can retriece with SEQUENCENAME.CURRVAL for this value (current sequence value).
For your information, SEQUENCENAME.NEXTVAL is used to get the primary key value in program, and this will increase sequence number to next. Hope this is helping.
Previous Topic: Queries slow because table is empty? is this true?
Next Topic: oracle time handlling
Goto Forum:
  


Current Time: Thu Apr 25 06:53:45 CDT 2024