Subject | Generator created PK in trigger: how to get that value? |
---|---|
Author | Jaume Andreu Sabater Malondra |
Post date | 2002-08-13T09:25:18Z |
Hi everyone.
I have got these tables: NEWS - NEWS_LANGUAGE - LANGUAGES, N-M cardinality.
I want to insert a row in table NEWS, then multiple rows in table
NEWS_LANGUAGE using the primary key just created on NEWS as foreign key on
NEWS_LANGUAGE.
I have got a stored procedure, POST_NEWS, which first inserts in table
NEWS. A trigger on event "before insert" raises and, using a generator,
creates an integer value which is used as primary key.
Now I would like to know how to get that "just created" value without
having to launch a SELECT query after that INSERT.
Finally, using that integer value, I have to launch multiple INSERT
statements on table NEWS_LANGUAGE, which shouldn't give me any trouble if a
owe the primary key integer value.
Thanks in advance.
P.S.: I am sending again this message because I didn't receive it when sent
for first time, just after I subscribed. I apologize if this is the second
time you read it :-)
--
Jaume Andreu Sabater Malondra
jsabater@...
Registered linux user #209072
"Ubi sapientas ibi libertas"
I have got these tables: NEWS - NEWS_LANGUAGE - LANGUAGES, N-M cardinality.
I want to insert a row in table NEWS, then multiple rows in table
NEWS_LANGUAGE using the primary key just created on NEWS as foreign key on
NEWS_LANGUAGE.
I have got a stored procedure, POST_NEWS, which first inserts in table
NEWS. A trigger on event "before insert" raises and, using a generator,
creates an integer value which is used as primary key.
Now I would like to know how to get that "just created" value without
having to launch a SELECT query after that INSERT.
Finally, using that integer value, I have to launch multiple INSERT
statements on table NEWS_LANGUAGE, which shouldn't give me any trouble if a
owe the primary key integer value.
Thanks in advance.
P.S.: I am sending again this message because I didn't receive it when sent
for first time, just after I subscribed. I apologize if this is the second
time you read it :-)
--
Jaume Andreu Sabater Malondra
jsabater@...
Registered linux user #209072
"Ubi sapientas ibi libertas"