Oracle WPG_DOCLOAD
Version 18.3.0.1

General Information
Library Note Morgan's Library Page Header
Coming to OpenWorld 2018? Be sure to visit the TidalScale booth in Moscone South and learn how to solve performance problems and lower costs with Software Defined Servers. Before you visit the booth, or if you can't make it this year, check out TidalScale at www.tidalscale.com. Be sure to click on the Solutions link and look through the Oracle resources.
Purpose Provides an interface to download files, BLOBs and BFILEs for use with the PL/SQL Gateway
AUTHID DEFINER
Constants
Name Data Type Value
max_doctable_name_len PLS_INTEGER 256
mimet_col_len PLS_INTEGER 48
name_col_len PLS_INTEGER 64
Data Types TYPE parts_table IS TABLE OF VARCHAR2(256) INDEX BY BINARY_INTEGER;
Dependencies
DBMS_ASSERT DBMS_SYS_SQL OWA_UTIL
DBMS_LOB HTP UTL_RAW
DBMS_SQL    
Documented Yes
First Available Not known
Security Model Owned by SYS with EXECUTE granted to PUBLIC and ORDS_METADATA
Source {ORACLE_HOME}/rdbms/admin/wpgdocs.sql
Subprograms
 
DOWNLOAD_FILE
Signals the PL/SQL Gateway of a file is to be downloaded to the client's browser

Overload 1
wpg_docload.download_file(
p_filename IN VARCHAR2,
p_bcaching IN BOOLEAN DEFAULT TRUE);
TBD
Overload 2 wpg_docload.download_file(p_blob IN OUT NOCOPY BLOB);
TBD
Overload 3 wpg_docload.download_file(p_bfile IN OUT BFILE);
TBD
 
GET_CONTENT_LENGTH
Return the length of a lob to be downloaded wpg_docload.get_content_length RETURN PLS_INTEGER;
SELECT wpg_docload.get_content_length
FROM dual;
 
GET_DOWNLOAD_BFILE
Fetch the bfile to be downloaded wpg_docload.get_download_blob(p_bfile OUT BFILE);
TBD
 
GET_DOWNLOAD_BLOB
Fetch the blob to be downloaded wpg_docload.get_download_blob(p_blob OUT NOCOPY BLOB);
TBD
 
GET_DOWNLOAD_FILE (private ... do not use)
Get the name and mime_type of the file to be downloaded wpg_docload.get_download_file(p_doc_info OUT VARCHAR2);
TBD
 
GET_DOWNLOAD_FILE_RAW
Get the name and mime_type of the file to be downloaded wpg_docload.get_download_file_raw(p_doc_info OUT RAW);
TBD
 
IS_FILE_DOWNLOAD
Undocumented wpg_docload.is_file_download RETURN BOOLEAN;
-- Unvalidated: From an internet source of unknown reliability

GRANT execute ON display_easy_image TO public;

CREATE OR REPLACE PROCEDURE display_easy_image( p_id NUMBER ) AS
 s_mime_type VARCHAR2(48);
 n_length NUMBER;
 s_filename VARCHAR2(400);
 lob_image BLOB;
BEGIN
  SELECT mime_type, dbms_lob.getlength( blob_content ), filename, blob_content
  INTO s_mime_type, n_length, s_filename, lob_image
  FROM easy_image
  WHERE image_id = p_id;

  -- set the size so the browser knows how much it will be downloading.
  owa_util.mime_header(NVL(s_mime_type, 'application/octet' ), FALSE);
  htp.p('Content-length: ' || n_length);
  -- The filename will be used by the browser if the users does a "Save as"
  htp.p('Content-Disposition: filename="' || s_filename || '"');
  owa_util.http_header_close;
  -- Download the BLOB
  wpg_docload.download_file(lob_image);
END display_easy_image;
/

Related Topics
Built-in Functions
Built-in Packages
DBMS_LOB
What's New In 12cR2
What's New In 18cR3

Morgan's Library Page Footer
This site is maintained by Dan Morgan. Last Updated: This site is protected by copyright and trademark laws under U.S. and International law. © 1998-2017 Daniel A. Morgan All Rights Reserved