How do I get a recid value from a just inserted record
am 28.08.2002 05:45:27 von Chris RuprechtHi all,
I have 3 tables (extremely simplified):
a:
a.recid default sequence_a
a.name
b:
b.recid default sequence_b
b.address
b.city
c:
c.recid default sequence_c
c.arecid
c.brecid
each has a default sequence on their respective recid - which is the primar=
y=20
index.
when I do an "insert into a ...", it automagically assigns recid a new, uni=
que=20
value, same goes for b.
But to create c, I need to know the recid from a and b, so I can connect th=
e=20
two.
Is there any way to get the recid from a and b after they have been inserte=
d=20
like in "insert into a ... and give me the recid you're going to use, back"?
I know, I can do a "netxval('...')" stuff and then insert the records with=
=20
values in recid, but that requires two extra calls to the DB per transactio=
n.
Best regards,
Chris
---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org