Subject Re: Returning a value from a Stored Procedure
Author Adam
--- In firebird-support@yahoogroups.com, Tim <tim@...> wrote:
>
>
> >
> >You can't do this in a reliable way.
> >
> >Do it differently. Change your trigger to:
> >
> >if ( (new.recordno is null) or (new.recordno = 0) )
> >then new.recordno = gen_id(gen_1, 1);
> >
> >Now, in your procedure do:
> >
> >recordno = gen_id(gen_1, 1);
> >insert into table1 (recordno, fieldone)
> >values :recordno, :field1;
>
> One more question :
>
> I presume I would get this value (in Delphi) by using something like
>
> SELECT RECORDNO FROM MYPROCEDURE(VALUE)

There are two types of stored procedures, executable stored procedures
and selectable stored procedures. If you want to run your stored
procedure in this syntax, it is called a selectable stored procedure.

Firebird will return a record to your application every time you call
suspend, so in this case it will work if you put on the last line of
your procedure.

suspend;

Otherwise, you need to use the execute procedure returning blah syntax
that I never remember.

Adam