Binary Large Objects – otherwise known as BLOBs. You’ve also got large objects which are composed of text – that would be a CLOB. If you hear people talk about LOB storage, they are referring to how the data in these fields are stored – outside the space reserved for the regular segments (table data.)

BLOBs are frequently used to store data such as pictures in the database. You can pretty much store anything in a BLOB, but it seems I most frequently get asked how to ‘look at pictures in the database.’ So here’s how to load data to a BLOB and how to preview the data stored in a BLOB using SQL Developer.

How to load a file to a BLOB

  • Find your table
  • The BLOB cell will say (BLOB)
  • Double-right-mouse-click
  • Hit the ‘pencil’ button
This opens the advanced edtior
  • On the ‘Local Data’ panel, use the ‘Load’ hyperlinked text
  • Navigate to your file, select and click ‘Open’
  • COMMIT your transaction
COMMITment issues? Try the button.

How to view a picture stored as a BLOB

Same process as above, at least for the first four steps. After you have opened the blob editor, you should see a ‘View as Image’ check box on the top part of the form. Click on that and SQL Developer will display the BLOB data in picture form.

A picture of The Blob stored as a BLOB

Have something other than a picture stored in that BLOB? That’s OK, use the ‘Download’ method instead. Save it to a file, then use the Log panel to quickly open your file.

The file logging feature is new for SQL Developer v3.1.

thatjeffsmith
Author

I'm a Master Product Manager at Oracle for Oracle SQL Developer. My mission is to help you and your company be more efficient with our database tools.

72 Comments

  1. Jack Applewhite Reply

    I looked at the post, tried it (without using Cart), and it does work to get the BLOBs out to separate files. However, they all need renaming to have the original PDF filename. That’s stored in another column of the Report_Cards table, so I can include that and the BLOB column to get a *.ldr file with two fields – the original filename and the unloaded BLOB file name. I suppose I can use that to create a script to rename all the unloaded files to their original *.pdf names, but is there another way? Can this be scripted with sdcli or sqlcl?

    SD is a wonderful tool and I appreciate what it does very much. We use it extensively for DBA work.
    Thanks.
    Jack

    • Jack Applewhite

      I’ll see if I can do the sqlcl + java scripting. Otherwise, I’ll need help from one of the Java heads at work.

      Thanks.
      Jack

  2. Jack Applewhite Reply

    I’m re-posting this as a Comment to the original Quick Tip, not a reply to an old comment.

    You said “…use the ‘Download’ method instead. Save it to a file…” which is the ONLY way I’ve found to write out a >32KB BLOB to an OS file. I’m now on SD 19.2 and very much want to script this function to unload 80,000+ PDFs of about 1MB each to OS files. This for the purpose of converting them to BFiles. BTW, we are a K12 school district and these are student report cards – a new set get produced every 6 to 9 weeks.

    If you know another way to UNload large BLOBs to OS files, I’d love to hear it. Most everything I’ve come across, including DBMS_LOB is almost exclusively on how to Upload BLOBs from OS files or convert BFiles to Internal BLOBs.

    I was hoping maybe sdcli or sqlcl could do it, but can’t see how unless we use sqlcl as a way to execute Java.

    Thanks.
    Jack

Write A Comment