prompt SF_ZY_GETBRJSXB 住院获取病人结算记录的性别 create or replace function SF_ZY_GETBRJSXB ( Pzyid00 in number, --住院id Pyexm00 in varchar2, --婴儿姓名 Pxb0000 in varchar2 --原性别 ) -- MODIFICATION HISTORY -- Person Date Comment -- linzetao 2024.09.05 create住院获取病人结算记录的性别 return varchar2 is Vxb0000 ZY_BRXXB0.XB0000%type; --返回值 begin Vxb0000 := null; if nvl(Pzyid00,0) <= 0 then return Vxb0000; end if; if nvl(Pyexm00,'全部') in ('全部','母亲') then if trim(Pxb0000) is not null then Vxb0000 := Pxb0000; else select max(XB0000) into Vxb0000 from ZY_BRXXB0 where ZYID00=Pzyid00; end if; else select nvl(max(YEXB00),Pxb0000) into Vxb0000 from BQ_JSXX00 where ZYID00=Pzyid00 and YEXM00=Pyexm00; if trim(Vxb0000) is null then select max(XB0000) into Vxb0000 from ZY_BRXXB0 where ZYID00=Pzyid00; end if; end if; return Vxb0000; end; / show error;