Subject Re: [firebird-support] Queries in UDFs
Author Helen Borrie
At 05:13 PM 17/11/2007, you wrote:
>Hi!
>
>I would like to write a user-defined function that performs a lookup
>operation on a db table as part of its calculations. I was wondering,
>what would be the best way to achieve this?

Don't. You'll crash Firebird every time you call it.

>I know that such a functionality could be achieved by writing a stored
>procedure. But it is not possible to use stored procedures that return
>scalars in the same manner as functions, right?

Well, it is possible. You can write an executable SP that returns a single output field. It's not a function, though it really depends how you want to use it.

But the normal way to return a scalar field in a set is simply to use a correlated subquery expression in your dynamic query.

Provide an example of what you want to achieve so that people can share some of their favourite tricks with you. :-)

./heLen