Subject | Re: Returning a value from a Stored Procedure |
---|---|
Author | Adam |
Post date | 2006-05-20T00:15:55Z |
--- In firebird-support@yahoogroups.com, Tim <tim@...> wrote:
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
>There are two types of stored procedures, executable stored procedures
>
> >
> >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)
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