函数:
create or replace function MyFun1(v_custId in cm_customer.cust_id%type)
return varchar2 is
Result varchar2(100);
begin
select t.cust_code || ' ' || t.cust_name
into Result
from so1.cm_customer t
where t.cust_id = v_custId;
return(Result);
end MyFun1;
--函数调用
--select t.cust_id,t.cust_code,t.cust_name,getCustNameCode(t.cust_id) from so1.cm_customer t
--select getCustNameCode(89101110014395) from dual;
本文介绍了一个PL/SQL函数的创建过程及其调用方式。该函数名为MyFun1,接收一个客户ID作为参数,并返回一个包含客户代码与名称组合的字符串。通过SELECT语句演示了如何使用此函数。

被折叠的 条评论
为什么被折叠?



