Subject | call function |
---|---|
Author | wiyono |
Post date | 2011-07-22T02:14:55Z |
Dear All
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;
Thanks
===============================================================================================
This e-mail transmission is intended solely for the ordinary user of the e-mail address
to which it was addressed. It may contain legally privileged and/or confidential information.
If you have received this e-mail in error or are not an intended recipient please inform
the sender with-out delay and delete this e-mail, attachments and possible copies immediately.
The unauthorized use, disclosure, distribution and/or copying of this e-mail or any information
it contains is prohibited
[Non-text portions of this message have been removed]
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;
Thanks
===============================================================================================
This e-mail transmission is intended solely for the ordinary user of the e-mail address
to which it was addressed. It may contain legally privileged and/or confidential information.
If you have received this e-mail in error or are not an intended recipient please inform
the sender with-out delay and delete this e-mail, attachments and possible copies immediately.
The unauthorized use, disclosure, distribution and/or copying of this e-mail or any information
it contains is prohibited
[Non-text portions of this message have been removed]