create or replace function SP_YS_TSBRXXTS(ad_BRID00 number) return varchar2 is VCOUNT0 number(5); VMSG000 varchar2(120); VCOUNT1 number(5); -- MODIFICATION HISTORY -- Person Date Comments -- dsm 2017.11.16 create for MZYS-20171103-002 -- huangjy 2018.10.12 修正参数控制取值为Value0 for YF-20180720-001 -- dsm 2020.02.27 吴伟钦归档 建档立卡的贫困人口-->建档立卡 for MZYS-20191030-003 ls_yyid00 xt_yyxx00.yyid00%type; ls_brzjbh bm_brxxb0.brzjbh%type; begin VMSG000:=''; select count(*) into VCOUNT0 from BM_BRXXB0 where BRID00=ad_BRID00 and instr(BRZTQK,'建档立卡')>0; ----龙岩人民医院扶贫病人新增身份证匹配 select yyid00 into ls_yyid00 from xt_yyxx00; if ls_yyid00='229112' then select count(1) into VCOUNT0 from bm_brxxb0 where brid00=ad_BRID00 and (brztqk like '%建档%' or brztqk like '%特困%' or brztqk like '%低保%' or brztqk like '%扶贫%'); select count(1) into VCOUNT1 from bm_brxxb0 where brid00=ad_BRID00 and trim(brzjbh) in (select trim(brzjbh) from bm_brxxb0_jzfp); end if; if VCOUNT0>0 or VCOUNT1>0 then begin select substr(trim(VALUE0),3,100) into VMSG000 from XT_XTCS00 where NAME00='YS_DKTSBRTS' and substr(VALUE0,1,1)='Y'; exception when others then VMSG000:=''; end; end if; return VMSG000; end;