Subject | Re: [firebird-support] procedure question or multiple table keys |
---|---|
Author | Alexandre Benson Smith |
Post date | 2004-05-31T22:18:09Z |
dleec45 wrote:
If you wish that all records have the same key on multiple tables, the
best you can do, is retrieve the key number and put that on your insert
statements.
If you use generator, you cannot ask for the value after you insert,
since this value could be changed by other actions. Retrieve it first
and use it in everywhere you wish.
see you !
--
Alexandre Benson Smith
Development
THOR Software e Comercial Ltda.
Santo Andre - Sao Paulo - Brazil
www.thorsoftware.com.br
>I have a situation where I need to add several records to severalLee,
>tables and want them to all have the same key. First of all I'm new
>to Firebird15 and don't know how to do this but I found this examples
>on the IBPhoenix home page that will return the genID and insert a
>record using that value. Is this a common way to use the returned
>value in other inserts so that the value of all necessary tables have
>a common key?
>
>DECLARE variable var_id integer;
>BEGIN
>execute procedure call_gen_id
>returning_values :var_id;
>insert into t1 (pkey, a_string)
>values (:var_id, :in_string);
>new_id = :var_id;
>string_sent = :in_string;
>SUSPEND;
>END
>
>Hope this is clear. Regards, Lee
>
>
If you wish that all records have the same key on multiple tables, the
best you can do, is retrieve the key number and put that on your insert
statements.
If you use generator, you cannot ask for the value after you insert,
since this value could be changed by other actions. Retrieve it first
and use it in everywhere you wish.
see you !
--
Alexandre Benson Smith
Development
THOR Software e Comercial Ltda.
Santo Andre - Sao Paulo - Brazil
www.thorsoftware.com.br