sql_demo

SELECT M.INSTNCODE, M.METHODCODE, M.CCYPAIRCODE, M.DIR, M.PRD, M.EXCHANGERATE, M.NEARRSKAMOUNT, M.TRADINGMODE, M.DEALCODE, M.DATECONFIRM, M.CFETSINSTNCODE
FROM (SELECT
CASE WHEN T.INTR_INSTN_CD = T.QTNG_INSTN_CD THEN T.INTR_INSTN_CD ELSE T.QTNG_INSTN_CD END AS INSTNCODE,
NVL(T.TRDNG_MTHD_CD, '--') AS METHODCODE,
T.CCY_PAIR_CD AS CCYPAIRCODE,
DECODE(T.INTR_INSTN_CD, T.QTNG_INSTN_CD, 'S', 'B') AS DIR,
T.PRD AS PRD,
DECODE(NVL(T.NLEG_SPOT_EXCHNG_RATE, 0), 0, '--', NVL(T.NLEG_SPOT_EXCHNG_RATE, 0)) AS EXCHANGERATE,
DECODE(NVL(T.NR_LEG_RSK_AMNT, 0), 0, '--', NVL(T.NR_LEG_RSK_AMNT, 0)) AS NEARRSKAMOUNT,
T.TRDNG_MD AS TRADINGMODE,
T.DL_CD AS DEALCODE,
T.DT_CNFRM AS DATECONFIRM,
CASE T.TKR_CFETS_INSTN_CD WHEN T.QT_INSTN_CFETS_INSTN_CD  THEN T.TKR_CFETS_INSTN_CD ELSE T.QT_INSTN_CFETS_INSTN_CD END AS CFETSINSTNCODE
FROM FX_DL_DTL T WHERE T.DL_ST != 2 AND T.DT_CNFRM >= TO_DATE('2019-04-10', 'YYYY-MM-DD') AND T.DT_CNFRM <= TO_DATE('2019-04-11', 'YYYY-MM-DD')
UNION ALL
SELECT
CASE WHEN O.INTR_INSTN_CD = O.QTNG_INSTN_CD THEN O.INTR_INSTN_CD ELSE O.QTNG_INSTN_CD END AS INSTNCODE,
NVL(O.TRDNG_MTHD_CD, '--') AS METHODCODE,
O.CCY_PAIR_CD,
DECODE(O.INTR_INSTN_CD, O.QTNG_INSTN_CD, 'S', 'B') AS DIR,
O.PRD,
DECODE(NVL(O.NLEG_SPOT_EXCHNG_RATE, 0), 0, '--', NVL(O.NLEG_SPOT_EXCHNG_RATE, 0)) AS EXCHANGERATE,
DECODE(NVL(O.NR_LEG_RSK_AMNT, 0), 0, '--', NVL(O.NR_LEG_RSK_AMNT, 0)) AS NEARRSKAMOUNT,
O.TRDNG_MD,
O.DL_CD,
O.DT_CNFRM,
CASE O.TKR_CFETS_INSTN_CD WHEN O.QT_INSTN_CFETS_INSTN_CD  THEN O.TKR_CFETS_INSTN_CD ELSE O.QT_INSTN_CFETS_INSTN_CD END AS CFETSINSTNCODE
FROM FX_DL_DTL_HSTRY O WHERE O.DL_ST != 2 AND O.DT_CNFRM >= TO_DATE('2019-04-10', 'YYYY-MM-DD') AND O.DT_CNFRM <= TO_DATE('2019-04-11', 'YYYY-MM-DD'))  M ORDER BY M.PRD, M.INSTNCODE;
上一篇:实训books,检查版


下一篇:【Vue Router】004-嵌套路由