CREATE OR REPLACE VIEW vw_bq_ybzhxx (
   zyid00,
   rycwh0,
   xb0000,
   xm0000,
   dqbq00,
   dqks00,
   brzt00,
   zyh000,
   kyje00,
   ybmc00,
   ybqfbz,
   ybzfbl,
   brid00,
   jflbmc,
   jflbid,
   sfdj00,
   zye000,
   ykzye0,
   wjsje0,
   tyje00,
   bjje00,
   yxqfje,
   ybyjs0,
   ybyzf0,
   ybzhye,
   yjje00,
   fylj00,
   qrfyze )
AS
SELECT
  X.ZYID00,
  X.RYCWH0,
  X.XB0000,
  X.XM0000,
  X.DQBQ00,
  X.DQKS00,
  X.BRZT00,
  X.ZYH000,
  SF_BQ_KYJE00(null,B.BRID00)KYJE00,
  L.YBMC00,
  L.YBQFBZ,
  L.YBZFBL,
  B.BRID00,
  J.JFLBMC,
  Z.JFLBID,
  Z.SFDJ00,
  Z.ZYE000,
  Z.YKZYE0,
  Z.WJSJE0,
  Z.TYJE00,
  Z.BJJE00,
  SF_BQ_YXQF00(NULL,B.BRID00)YXQFJE,
  Z.YBYJS0,
  Z.YBYZF0,
  Z.YBZHYE,
  SF_SF_QDYJE0(X.ZYID00,to_char(sysdate,'YYYYMMDD')) YJJE00,
  SF_SF_QDFYLJ(X.ZYID00,to_char(sysdate,'YYYYMMDD')) FYLJ00,
  nvl((SELECT SUM(HJJE00) FROM VW_BQ_RQDMX0 K Where X.ZYH000=K.ZYH000  AND TO_Char(SYSDATE-1,'YYYYMMDD')=K.QDH000),0) QRFYZE
FROM ZY_BRZHXX Z,ZY_BRXXB0 X,BM_BRJFLB J,BM_BRXXB0 B,VW_BQ_YBZFBL L
WHERE Z.BRID00=X.BRID00 AND Z.JFLBID=J.JFLBID AND Z.BRID00=B.BRID00  AND
      B.BRID00=X.BRID00 AND B.YBLB00=L.YBLB00 AND B.YBBRLB=L.YBBRLB  AND
      J.SYBZ00='1' AND J.SFYX00='Y' and b.fbbh00=l.fbbh00
/