Thursday, September 1, 2016

How to Display a BLOB image in an APEX Report

Do you want to display an image on a report in APEX ?

Is the image stored as a BLOB data type in your schema or the blob is returned by some functions?

If so, then displaying the BLOB is not a simple or straight forward task.

Actually it is a simple and straight forward task, as long as you know "the trick" you need to create/defined in your APEX report.

The following steps outlines what you need to do to create a report with a BLOB images. Most of these are the standard steps, except for Step 4. That is the important one.

1. Create the Report using the APEX wizard

Create a new report. In my example here I'm going to create a classic report.

NewImage Enter a title for the report, and accept the default settings NewImage

Create as new navigation menu entry


2. Define the Table or Query for the Report

Select the table or view that contains the data or define the SQL Query to return the results. It might be best to select this later option as it will make things clearer and easier to change in Step 4.


Click next on the next 2 screens of the wizard and then click the Create button.

3. Set the BLOB attribute settings

When you run the report you will get something like the following being displayed. As you can see it clearly does not display the BLOB image.


Next we need to setup the BLOB attribute settings. As shown in the following.

Screenshot 2016 08 26 13 59 30

When we run the report now, we now get an error message.


4. Change the report query to return the length of the BLOB

Now this is the magic bit.

To get the image to display you need to go back to the Report level and change the query in the SQL Query box, to contain function below that get the length of the image in the BLOB attribute, dbms_lob.getlength() (in my example this attribute is call IMAGE)

select ID,
       dbms_lob.getlength(image)  image
Screenshot 2016 08 26 14 07 59

5. The BLOB object now appears :-)

That's it. Now when you run your report the image will be displayed.


So now you know how to display a BLOB image in an APEX Report.

(Thanks to Roel and Joel for the help in working out how to do this)


  1. Replies
    1. See my blog post that covers this

  2. Hi is this the only way to allow a blob image to display in APEX5 (Changing the column type in the application builder to type ‘Display image’?)

    We have migrated one of our applications from APEX4 to APEX5. The image displays fine in APEX4 but once we import the application into APEX5 the images do not appear. The column for the image migrates over as a plain text attribute… Does this mean I need to change the type to Display image and pass through the table name/BLOB column/Primary key column 1 under BLOB attributes. Can we get this working without changing this data in the application builder and the code for the select statement?

    Many thanks Helen.

    1. Yes this seemed to be the way to do it in Apex 5. Yes it was simpler in Apex 4. I got some help from Joel Kallman to get this working.

    2. Thank-you for the speedy reply. Sadly this is not the answer we hoped for (lots of approvals to go through now!). Good thing is I have got everything working following your instructions so Thank-you for the blog post and helping me get one more problem corrected!

      All the best,

    3. Brendan, I've tried this method for images and it works 100%, thanks.

      I'm trying to do the same for PDF docs saved in a BLOB, which does not seem to work. Is there another trick for PDF docs?

    4. Hi Neil. Yes I think there is some additional steps for processing a PDF. A quick google and I found these links