Is it possible to create a stored procedure with two insert statements where id/primary_key from the first insert statement will be used in second.
For eg.
INSERT INTO activity VALUES (DEFAULT, 'text', 'this is a test');
If the id returned from the above statement is x, the second insert will be like:
INSERT INTO activity_tree VALUES (DEFAULT, **x**, user_id) or something like that.
I understand thatlibpq has functions which can give the id from the first statement.
But I want to combine them into a stored procedure. Please advise.
Regards, Mayank