Home > Advanced Programming Techni... > About BLOB Support in Forms... > About BLOB Support in Reports
Oracle Application Express includes BLOB
support for both classic and interactive reports. If you use a wizard to create a report and include a column of type BLOB
, basic support will be included. Additional information should be added after generation to make the download capability more user friendly.
To facilitate the inclusion of a download link in a report, the report includes the selection of the length of the BLOB
(for example, dbms_lob.getlength(RESUME)
). If the length is 0, the BLOB
is NULL
and no download link is displayed. In the same way you specify a format mask for a date or number you can format a download link. The DOWNLOAD format is more complex however then other format masks in that you are required to specify at least three parameters, for example:
DOWNLOAD:EMP:RESUME:EMPNO
The parameters of the DOWNLOAD format are described in the following table:
Position | Attribute | Required | Description |
---|---|---|---|
1 | DOWNLOAD | Yes | Identifies the DOWNLOAD report format mask. |
2 | Table Name | Yes | Case sensitive name of table containing target column of type BLOB . |
3 | Column containing BLOB | Yes | Case sensitive name of column of type BLOB . |
4 | Primary Key Column 1 | Yes | Case sensitive name of primary key column 1. |
5 | Primary Key Column 2 | No | Case sensitive name of primary key column 2. |
6 | MIME type Column | No | Case sensitive column name used to store the MIME type. |
7 | Filename Column | No | Case sensitive column name used to store the filename of the BLOB . If NULL , the column name is used as the default when a user downloads the file. |
8 | Last Update Column | No | Case sensitive column name used to store the last update date of the BLOB . If used, the HTTP header of the file download indicates the date of last modification and Web browsers will be able to cache the BLOB . If not specified, the browser may not be able to cache files. |
9 | Character Set Column | No | Case sensitive column name used to store the character set of the BLOB . Most relevant for Asian languages which may need to maintain the character set encoding. |
10 | Content Disposition | No | Specify inline or attachment . All other values ignored. If a MIME type is provided and the file is a type that can be displayed, the file will be displayed. If MIME type is not provided, or the file cannot be displayed inline, the user will be prompted to download. |
11 | Download Text | No | String used for the download link. If nothing provided, Download is used. Note that this will support substitutions (useful for translated applications). |
Consider the following example:
DOWNLOAD:EMP:RESUME:EMPNO::RESUME_MIMETYPE:RESUME_FILENAME:RESUME_LAST_UPDATE::attachment:Resume
If you have a report column with a format mask that begins with DOWNLOAD:
, you will see a link below the format 'BLOB Download Format Mask'. This popup assists in entering all the parameters necessary for the DOWNLOAD format.
Tip: To see a real example, go to Sample Application, page 29 (Master Detail), Items for Order #&P29_ORDER_ID. region, Product Image column. See "Running a Demonstration Application". |
If the BLOB
you are working with is an image, you can display it in the report as well. To do this, you use the new report format mask of 'IMAGE'. Regardless of the MIME
type, the report will always attempt to display the BLOB. If the BLOB cannot be rendered, a broken image will be displayed.
The parameters of the IMAGE format mask are described in the following table:
Position | Attribute | Required | Description |
---|---|---|---|
1 | IMAGE | Yes | Identifies the IMAGE report format mask. |
2 | Table Name | Yes | Case sensitive name of table containing target column of type BLOB . |
3 | Column containing BLOB | Yes | Case sensitive name of column of type BLOB . |
4 | Primary Key Column 1 | Yes | Case sensitive name of primary key column 1. |
5 | Primary Key Column 2 | No | Case sensitive name of primary key column 2. |
6 | MIME type Column | No | Case sensitive column name used to store the MIME type. |
7 | Filename Column | No | Not used for IMAGE format but left in so that the format can easily be changed between IMAGE and DOWNLOAD. |
8 | Last Update Column | No | Case sensitive column name used to store the last update date of the BLOB . If used, the HTTP header of the file download indicates the date of last modification and Web browsers will be able to cache the BLOB . If not specified, the browser may not be able to cache files. |
9 | Character Set Column | No | Not used for IMAGE format but left in so that the format can easily be changed between IMAGE and DOWNLOAD. |
10 | Content Disposition | No | Not used for IMAGE format but left in so that the format can easily be changed between IMAGE and DOWNLOAD. |
11 | Alt Text | No | String used for the alt tag associated with the image. |
Consider the following example:
IMAGE:EMP:RESUME:EMPNO::RESUME_MIMETYPE:RESUME_FILENAME:RESUME_LAST_UPDATE::attachment:Resume
If you have a report column with a format mask that begins with 'IMAGE:', you will see a link below the format 'BLOB Download Format Mask'. This popup assists in entering all the parameters necessary for the IMAGE format.