sql >> データベース >  >> RDS >> Oracle

Oracleでxmlconcat関数を使用する方法

    WITH vw_cdic_uci_detail AS ( SELECT 546 AS vcud_lei, 'BMO2100001200001' AS vcud_uci, 50 AS vcud_per FROM DUAL UNION ALL
                                 SELECT 546 AS vcud_lei, 'BMO2100005500012' AS vcud_uci, 50 AS vcud_per FROM DUAL
                               )
    SELECT XMLELEMENT( "BusProcess",
              XMLFOREST(
                 XMLFOREST( '65443W404' AS "CUSIP",
                            100         AS "RUP",
                            2500        AS "ACB"
                 ) AS "CRR"
              ),
              XMLELEMENT("LEI", vcud_lei),
              XMLCONCAT( AddModCDIC ) AS "AddModCDIC"
           )
      FROM ( SELECT vcud_lei,
                    CASE
                       WHEN 1=1
                       THEN
                       XMLCONCAT(
                          XMLELEMENT("AddModCDIC",
                             XMLELEMENT("CDICData",
                                XMLAGG(
                                         XMLELEMENT("UCIData",
                                            XMLFOREST(vcud_uci AS "UCI",
                                                      vcud_per AS "InterestlnDeposit"
                                      )
                                   )
                                )
                             )
                          )
                       ) 
                       ELSE NULL
                    END AS AddModCDIC
               FROM vw_cdic_uci_detail
              GROUP BY vcud_lei
          ) a;
    



    1. datagripでバインディング変数を使用できません

    2. JPAで2つの日付の間の日数をカウントします

    3. GROUP BY句でエイリアスを使用するにはどうすればよいですか?

    4. SQLSELECTNULLとSELECT1のパフォーマンスの比較