Subject Re: [firebird-support] returning_val
Author Thomas Steinmaurer
> I have a question to usage and performance of stored procedures that return only one result row/value.
> Is there a performance drawback when I code it as a selectable procedure, or should I use always the execute procedure syntax and drop the suspend?

I would always implement a singleton procedure result set as selectable
stored procedure. That way, you can use the procedure as an "inline"
select in your select statements. E.g.:

(select mycolumn from myproc(t.tablecolumn) ...) as anothercolumn
mytable t

> Is it correct that I can not assign directly to a variable as with a UDF?

Yes. Stored functions are AFAIK implemented in Firebird 3 HEAD. This
basically allows you to implement functions stored in the database
returning a scalar value.

Btw, in Firebird 2.5. You could also do the following with a selectable
stored procedure:

myvar = (select mycolumn from myproc);

Thus, you don't need the INTO part anymore ...

Best Regards,
Thomas Steinmaurer
LogManager Series - Logging/Auditing Suites supporting
InterBase, Firebird, Advantage Database, MS SQL Server and
NexusDB V2
Upscene Productions
My blog: