CREATE OR REPLACE FUNCTION SF_BQ_BRTSXXA(ad_ZYID00 in number ) return varchar2 is VBRID00 ZY_BRXXB0.BRID00%type; VCOUNT number(5); VCOUNT1 number(5); VSFJZFP varchar2(10); VMSG000 varchar2(500); VTSXX00 BM_MZJZBR.MZLY00%type; VTSWZ00 varchar2(10); --提示位置 -- MODIFICATION HISTORY -- Person Date Comments -- dsm 2018.05.14 create for BQ-20180428-001 -- dsm 2018.07.27 BQ_DKTSBRTS的第2位为Y时提示BM_MZJZBR.MZLY00 for BQ-20180727-001 -- dsm 2018.11.08 SF_ZY_SFJZFP考虑PSFJDLK for ZYSF-20181023-001 begin VTSXX00:=' '; select BRID00,substr(SF_ZY_SFJZFP(ad_ZYID00,0,to_char(VCOUNT),'0','0'),1,2) into VBRID00,VSFJZFP from ZY_BRXXB0 where ZYID00=ad_ZYID00; select count(1) into VCOUNT from BM_BRXXB0 a where a.BRID00 = VBRID00 and exists (select 1 from BM_MZJZBR b where b.BRSFZH = a.BRZJBH) ; if VCOUNT>0 or VSFJZFP='1' then begin select substr(trim(VALUE0),3,100),substr(trim(VALUE0),2,1) into VMSG000,VTSWZ00 from XT_XTCS00 where NAME00='BQ_DKTSBRTS' and substr(VALUE0,1,1)='Y'; if VTSWZ00='Y' then begin select nvl(MZLY00,' ') into VTSXX00 from BM_MZJZBR where BRSFZH in(select BRZJBH from BM_BRXXB0 where BRID00=VBRID00 ) and YXBZ00='1' and rownum=1; exception when others then VTSXX00:=' '; end; if VTSXX00 is not null then VMSG000:=VTSXX00; end if; end if; exception when others then VMSG000:=''; VTSWZ00:='N'; end; end if; return VMSG000; end; /