0 Replies Latest reply on Dec 18, 2017 1:44 PM by Mohammas

    ORDS - 500 Internal Server Error - ORA-22275: invalid LOB locator specified

    Mohammas

      Hi,

       

      Oracle 12C

      ORDS 3.0.5

      Apex 5.0.3

      Tomcat

       

      When we are trying to download a file from Apex, we are receiving the "Oracle Rest Data Services 500 Internal Server Error", from Tomcat Server log we found

      Caused by: java.sql.SQLException: ORA-22275: invalid LOB locator specified

      ORA-06512: at "Package", line 576

      ORA-06512: at line 2

         PROCEDURE download_doc (p_id IN NUMBER)
         AS
            l_mime        VARCHAR2 (255);
            l_length      NUMBER;
            l_file_name   VARCHAR2 (2000);
            l_blob        BLOB;
         BEGIN
            SELECT t.content_type,
                   t.doc,
                   t.doc_name,
                   DBMS_LOB.getlength (t.doc)
              INTO l_mime,
                   l_blob,
                   l_file_name,
                   l_length
              FROM table t
             WHERE t.doc_id = p_id;
            --
            -- set up HTTP header
            --
            -- use an NVL around the mime type and
            -- if it is a null set it to application/octect
            -- application/octect may launch a download window from windows
            OWA_UTIL.mime_header (NVL (l_mime, 'application/octet'), FALSE);
            -- set the size so the browser knows how much to download
            HTP.p ('Content-length: ' || l_length);
            -- the filename will be used by the browser if the users does a save as
            HTP.p (
                  'Content-Disposition: attachment; filename="'
               || REPLACE (
                     REPLACE (SUBSTR (l_file_name, INSTR (l_file_name, '/') + 1),
                              CHR (10),
                              NULL),
                     CHR (13),
                     NULL)
               || '"');
            -- close the headers
            OWA_UTIL.http_header_close;
            -- download the BLOB
            WPG_DOCLOAD.download_file (l_blob);
         EXCEPTION
            WHEN OTHERS
            THEN   
               RAISE;--(this is the line 576)
         END;
      

       

      We have multiple environments and it is working fine in most of them, except one environment. So the procedure has no issue, I am assuming it has to be ORDS config related issue, please let us know if there are any inputs around this.

       

      Thanks,

      Shoaib