Subject Re: Returning the Primary Key value of a new row added by a stored procedure?
Author ygboro
--- In firebird-support@yahoogroups.com, "Martijn Tonies"
<m.tonies@...> wrote:
>
> Adjust your trigger to only assign a value if the ID columns is empty,
> eg:
>
> IF (NEW.ID IS NULL OR NEW.ID = 0)
> THEN ...
>
> And modify your procedure so that it grabs a new value from the
generator
> first and uses that in the insert. You can safely return that new
value to
> your
> client.
>
> This way, you still have your trigger for SQL that doesn't use the
procedure
> AND you have a way to return the new value from your procedure.
>
>
> In Firebird 2.0, you could also check the RETURNING VALUES clause
> from an INSERT INTO and get the new value in your procedure and
> return it. Have a look at the Release Notes or new SQL extensions.
>
This is what I am seeking for. Please, Martijn, could you describe it
a little more ?

Boro