Subject Re: procedure question or multiple table keys
Author dleec45
--- In firebird-support@yahoogroups.com, Alexandre Benson Smith
<iblist@t...> wrote:
> dleec45 wrote:
>
> >I have a situation where I need to add several records to several
> >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
> >
> >
> 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 !
>
>Thanks Alexandre, I looked at the Release Notes for 15 and 'think' I
understand that what I want to do may work, except for one reason. I'm
using ADOdb and i don't think that this new feature is in that as
yet, or I'm not even certain that procedures can be executed either,
so I still have a problem that I don't know how to resolve. Thanks.