prompt 获取员工信息  SF_XT_GETBM_YGBM00
create or replace function SF_XT_GETBM_YGBM00
(
  PYGBH00 number                ,--员工编号
  PFHLX00 varchar2               --返回类型  0:员工姓名 1:医保医师代码 2:胸卡号 3:身份证号 4:医师证件号
)
return  varchar2 is
-- modification history
-- Person      Date            Comments
--zhangyc     2024.08.15  create by 	MZSF9-20240815-001
  LS_RETURN  varchar2(1000);
  LS_ZWXM00  BM_YGBM00.ZWXM00%type;--中文姓名
  LS_XKH000  BM_YGBM00.XKH000%type;--胸卡号
  LS_YBYGDM  BM_YGBM00.YBYGDM%type;--医保医师代码/医保护士代码
  LS_SFZBH0  BM_YGBM00.SFZBH0%type;--身份证号
  LS_YSZJHM  BM_YGBM00.YSZJHM%type;--医师证件号
begin	
	LS_RETURN := null;
  begin
	  select ZWXM00,XKH000,YBYGDM,SFZBH0,YSZJHM into LS_ZWXM00,LS_XKH000,LS_YBYGDM,LS_SFZBH0,LS_YSZJHM
	  from BM_YGBM00 where YGBH00=PYGBH00;
	exception
	when others then
   LS_ZWXM00:=null;--中文姓名
   LS_XKH000:=null;--胸卡号
   LS_YBYGDM:=null;--医保医师代码/医保护士代码
   LS_SFZBH0:=null;--身份证号
   LS_YSZJHM:=null;--医师证件号
	end;
if nvl(PFHLX00,'0')='0' then 
 LS_RETURN:=substr(LS_ZWXM00,1,1000);
elsif nvl(PFHLX00,'0')='1' then  	
 LS_RETURN:=substr(LS_YBYGDM,1,1000);
elsif nvl(PFHLX00,'0')='2' then  	
 LS_RETURN:=substr(LS_XKH000,1,1000);
elsif nvl(PFHLX00,'0')='3' then  	
 LS_RETURN:=substr(LS_SFZBH0,1,1000); 
elsif nvl(PFHLX00,'0')='4' then  	
 LS_RETURN:=substr(LS_YSZJHM,1,1000); 
end if;	
return trim(LS_RETURN);
end;
/
show error;
--%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%