Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Sequence ME!
Sequence Problems
This must be a common question but I have not seen it asked anywhere.
I have a table with a primary key of type NUMBER(10), I have a trigger setup
to populate that field on insert based off the sequence. My problem is when I
insert a record into that table I need to know what number the row was given,
for use in other FK's.
So if I insert one row, the on insert trigger will fire, populate the PK field
with the next sequence number and happily insert the row. How do get that PK
number once it is inserted.
I need some sort of Insert/Select statement that inserts the line and then returns a result set that only included the newly inserted line.
I know I can get the next sequence number manually via; SELECT SEQ_MRU.Nextval
INTO lvi_MruNbr FROM dual;
But wanted to know if there was a better way to handle this.
Any suggestions are welcome.
-Ken Received on Wed Apr 08 1998 - 10:01:54 CDT
![]() |
![]() |