Subject Re: Returning generated key was Re: [Firebird-Architect] Re: Indexed Views
Author Fabricio Araujo
On Thu, 23 Dec 2004 20:48:36 -0000, Roman Rokytskyy wrote:

>> > What gets returned for a mass insert?
>>
>> It should generate an error.
>
>Why? Why cannot one use
>
>INSERT INTO myTable(id, name)
> SELECT gen_id(myGen, 1), name FROM (
> SELECT DISTINCT name FROM students)
>RETURNING id;
>
>The only problem is to correctly describe it in
>isc_dsql_describe_bind, so the result set is returned.
>
>I think the answer should come from developers: if there is clean way
>to implement handling of INSERT that returns result set, not a
>singleton result, we can consider it. If implementing it would require
>some dirty hack in the engine, we wait till better times come.

If I have to retrieve the generator value, I get it beforehand and
use it on my query. Or submit the insertion to a INSERT procedure
which do dirty job and returns a row with the key.
The second method I use in MSSQL as well, since my database
is only acessed from SPs.



--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.298 / Virus Database: 265.6.4 - Release Date: 22/12/2004