Subject | INSERT INTO ... RETURNING with EXECUTE STATEMENT |
---|---|
Author | Tim Ward |
Post date | 2014-06-23T10:48:37Z |
Hi,
I see that this has been discussed before, but the only discussions I
could find were in Russian and I was not able to understand them.
I've got an INSERT statement like:
INSERT INTO <table>( <list of columns> )
SELECT <list of columns>
FROM <table whose name is not known until run time>
WHERE <something
RETURNING generated_primary_key INTO :variable
the point being that the name of the table used in the FROM isn't known
until run time. This needs to be inside a stored procedure for Firebird 2.1.
Elsewhere (simple SELECT, FOR SELECT) I've worked out how to do this
using EXECUTE STATEMENT.
But what, please, is the correct syntax for using EXECUTE STATEMENT for
an INSERT INTO ... SELECT ... RETURNING? - this isn't an example usage
which I've been able to find in any of the documentation.
Thanks.
--
Tim Ward
I see that this has been discussed before, but the only discussions I
could find were in Russian and I was not able to understand them.
I've got an INSERT statement like:
INSERT INTO <table>( <list of columns> )
SELECT <list of columns>
FROM <table whose name is not known until run time>
WHERE <something
RETURNING generated_primary_key INTO :variable
the point being that the name of the table used in the FROM isn't known
until run time. This needs to be inside a stored procedure for Firebird 2.1.
Elsewhere (simple SELECT, FOR SELECT) I've worked out how to do this
using EXECUTE STATEMENT.
But what, please, is the correct syntax for using EXECUTE STATEMENT for
an INSERT INTO ... SELECT ... RETURNING? - this isn't an example usage
which I've been able to find in any of the documentation.
Thanks.
--
Tim Ward