下载程序不适用于某些文件Apex

时间:2016-06-09 22:54:52

标签: oracle stored-procedures plsql oracle-apex

我一直在使用用于下载文件的APEX程序出现问题(代码直接来自Oracle网页):

CREATE OR REPLACE PROCEDURE download_my_file(p_file in number) AS
        v_mime  VARCHAR2(48);
        v_length  NUMBER;
        v_file_name VARCHAR2(2000);
        Lob_loc  BLOB;
BEGIN
        SELECT MIME_TYPE, BLOB_CONTENT, name,DBMS_LOB.GETLENGTH(blob_content)
                INTO v_mime,lob_loc,v_file_name,v_length
                FROM oehr_file_subject
                WHERE id = p_file;
              --
              -- 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(v_mime,'application/octet'), FALSE );

                -- set the size so the browser knows how much to download
                htp.p('Content-length: ' || v_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(v_file_name,instr(v_file_name,'/')+1),chr(10),null),chr(13),null)|| '"');
                -- close the headers            
                owa_util.http_header_close;
                -- download the BLOB
                wpg_docload.download_file( Lob_loc );
end download_my_file;
/

该程序适用于pdf文件和图像,但不适用于excel或word文件,给我一个" ORACLE 500 - 内部服务器错误"。    有谁知道如何解决这个问题?

由于

0 个答案:

没有答案