sql >> Database >  >> RDS >> Mysql

Extraheren uit een grote xml mislukt de query met een letterlijke tekenreeks die te lang is

Oplossing:

1.

    CREATE OR REPLACE FUNCTION  APE9_BLOB_2_CLOB(L_BLOB BLOB) RETURN CLOB IS
        L_CLOB         CLOB;
        L_SRC_OFFSET      NUMBER;
        L_DEST_OFFSET  NUMBER;
        L_BLOB_CSID       NUMBER := DBMS_LOB.DEFAULT_CSID;
        V_LANG_CONTEXT NUMBER := DBMS_LOB.DEFAULT_LANG_CTX;
        L_WARNING         NUMBER;
        L_AMOUNT  NUMBER;
      BEGIN
       DBMS_LOB.CREATETEMPORARY(L_CLOB, TRUE);
        L_SRC_OFFSET     := 1;
        L_DEST_OFFSET := 1;
        L_AMOUNT := DBMS_LOB.GETLENGTH(L_BLOB);
        DBMS_LOB.CONVERTTOCLOB(L_CLOB,
                               L_BLOB,
                               L_AMOUNT,
                               L_SRC_OFFSET,
                               L_DEST_OFFSET,
                               1,
                               V_LANG_CONTEXT,
                               L_WARNING);
        RETURN L_CLOB;
      END;
    /

2.

SELECT  XMLTYPE (APE9_BLOB_2_CLOB (XML_LOB )) PROFILE  
FROM APE1_XML_DISTRIB 
WHERE FILE_TYPE='Provider ID list' AND RELEASE_NAME='EPC_TO_PUB'

3.

    SELECT * FROM (
    WITH ET AS(
         SELECT 
                (SELECT  XMLTYPE (APE9_BLOB_2_CLOB (XML_LOB )) PROFILE  FROM APE1_XML_DISTRIB WHERE FILE_TYPE =  'Provider ID list' AND RELEASE_NAME='EPC_TO_PUB' ) AS  XT
          FROM DUAL
           ) 
            SELECT     
                EXT.*
               FROM
               ET,
               XMLTABLE(
               'for $SF in $GRP_2_ID/AuxiliaryType/AuxiliaryObject
                    for $SFItem in $SF/Row
                      return <row> 
                      {
                        $SF
                        ,$SFItem
                      } 
                      </row>'           
                  PASSING ET.XT AS GRP_2_ID
                  COLUMNS
                  ID   Number         PATH 'AuxiliaryObject/@id'  ,
                   PROVIDER_GROUP                 VARCHAR2  (256)       PATH 'AuxiliaryObject/@name' ,  
                   Index_id Number PATH 'Row/Index',              
                  PROVIDER_ID_DESC        VARCHAR2  (256)       PATH 'Row/Provider_ID_description',
                  PROVIDER_ID  VARCHAR2  (64)       PATH 'Row/Provider_ID'
                   ) EXT  
                   ) order by ID,Index_id



  1. host localhost mag geen verbinding maken met deze MySQL-server

  2. Prestatiemythen:tabelvariabelen zijn altijd in het geheugen

  3. PHP-functie werkt maar één keer

  4. MySQL Connect via proxy in Java