Subject | Re: [firebird-support] call function |
---|---|
Author | Thomas Steinmaurer |
Post date | 2011-07-22T05:00:13Z |
> Dear AllStored functions will be available in Firebird 3. But you could write a
>
> How to call function from Select
>
> Example (In Oracle)
>
> SELECT a.cus_cd, F_CusNm(a.cus_cd) cus_nm FROM table_a a
> This Function is
>
> CREATE OR REPLACE Function F_CusNm(sCusCd VARCHAR2)
> RETURN VARCHAR2
> IS rCusName Varchar2(30);
> BEGIN
> SELECT CUS_NM
> INTO rCusName
> FROM CUSTOMER
> WHERE Cus_CD = sCusCd;
> RETURN TRIM(rCusName);
> Exception
> When No_Data_Found then
> rCusName := '';
> Return rCUsName;
> END;
selectable stored procedure returning a scalar value and then use it
like that in the select statement:
select
...
, (select rCusName from myproc(sCusCd)) as myname
from
mytable
...
--
With regards,
Thomas Steinmaurer
Upscene Productions
http://www.upscene.com
http://blog.upscene.com/thomas/
Download LogManager Series, FB TraceManager today!
Continuous Database Monitoring Solutions supporting
Firebird, InterBase, Advantage Database, MS SQL Server
and NexusDB!