sql >> Database teknologi >  >> RDS >> Oracle

Sådan bruger du xmlconcat-funktionen i oracle

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. Rails Migration:Bigint på PostgreSQL ser ud til at fejle?

  2. SQL Server datoformat funktion

  3. Hvordan fletter jeg to eller flere rækker baseret på deres fremmednøgle?

  4. Udtrækning af indholdet af et element fra en ekstern side