APEX 4.1 enables to include a download link to LOB object in standard or interactive repors. Documentation is available here, however the approach is not so obvious from it. So here is quick recap, how it works:
- In report query you must have column that contains LOB length (not LOB itself!) – so something like
select dbms_lob.getlength(MY_LOB) my_lob_lenght from MY_TABLE
- The report column corresponding to LOB length should be set as:
Display As: Display As Text (escape special characters, does not save state)
Number/Date Format: DOWNLOAD:TABLE_NAME:LOB_COLUMN_NAME:ROW_PRIMARY_KEY_COLUMN
(beware names are case sensitive here) - When more sophisticated download behaviour is needed you should also include columns for MIME type of data, file name and modification timestamp. Once you store basic DOWNLOAD format you can edit it with masked edit link “BLOB Download Format Mask”
- Download link is only shown when LOB length > 0 and is not null.
Screenshot of column definition with DOWNLOAD format masked edit: