Search code examples
oracle-databaseoracle-apexoracle-apex-5oracle-apex-5.1

How to get a link for BLOB download on interactive report


I have got this query:

select MATERIAL_NAME,
       FILENAME,
       MIME_TYPE,
       DOC_SIZE,
       CONTENT
from materials;

Here the CONTENT column is of type BLOB. I can't get it to display a download link when I set its type to "Download BLOB", and its attributes etc.

Any help or advice would be greatly appreciated!


Solution

  • Don't select the column itself, but its size, i.e.

    select 
      MATERIAL_NAME,
      FILENAME,
      MIME_TYPE,
      DOC_SIZE,
      -- No: CONTENT
      -- Yes:
      dbms_lob.getlength(content) content
    from materials;
    

    [EDIT: some more info]

    Navigate to "content" column's properties and set the following properties (that's the minimum set you have to fill; if you know other values, fill them as well):

    • type: download BLOB
    • BLOB attributes:
      • table name: materials
      • BLOB column: content
      • primary key column 1: I don't know; set it to table's primary key column