这个函数总是没有返回值的???????????
create or replace function GetSupName(pid in varchar2) return varchar2 is
ret varchar2(10);
begin
select orgname into ret from organization
where orgid=pid;
return(ret);
end GetSupName;
--这样调用
select a.orgId,
a.orgName,
GETSUPNAME(a.pid) as supname,----------------------------
a.orgCnShort,
a.orgEnName,
a.orgEnShort,
a.orgLeader,
a.dutyTel,
a.email,
a.faxTel,
a.orgAddr,
decode(a.externalFlag,1, '是 ',0, '否 ') as externalFlag,
decode(a.postFlag,1, '否 ',0, '是 ') as postFlag
from organization a
------解决方案--------------------create or replace function GetSupName(v_pid in varchar2) return varchar2 is
ret varchar2(10);
begin
select orgname into ret from organization
where orgid=v_pid;
return(ret);
end GetSupName;
表organization中存在名为pid的字段了。