Mysql
 sql >> Teknologi Basis Data >  >> RDS >> Mysql

Mengekstrak dari xml besar kueri gagal dengan string literal terlalu panjang

Solusi:

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. Database
  2.   
  3. Mysql
  4.   
  5. Oracle
  6.   
  7. Sqlserver
  8.   
  9. PostgreSQL
  10.   
  11. Access
  12.   
  13. SQLite
  14.   
  15. MariaDB
  1. Mysql pilih catatan dengan offset

  2. Memilih slot waktu yang tersedia untuk tanggal tertentu

  3. Masukkan model Backbone.js ke dalam database MySQL

  4. PHP PDO vs mysql_connect biasa

  5. Kinerja MySQL bidang varchar unik vs bigint unik