Mysql
 sql >> база данни >  >> RDS >> Mysql

Извличането от голям xml заявката е неуспешна с твърде дълъг низов литерал

Решение:

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. Използвайте датата в клетката на Excel в клаузата BETWEEN в SQL заявка

  2. Странен резултат за GROUP_CONCAT при подзаявка

  3. Windows 8 и MySQL? Какви са моите опции?

  4. синтактична грешка, неочаквано 'mysql_connect' (T_STRING)

  5. Бавната заявка на Mysql:INNER JOIN + ORDER BY причинява сортиране на файлове