My Oracle Support Banner

How to Export Multiple BLOB Data, Each To Their Respective Filename (Doc ID 2753958.1)

Last updated on SEPTEMBER 02, 2024

Applies to:

Oracle SQL Developer - Version 19.4 and later
Information in this document applies to any platform.

Goal

You have an Oracle Database Table containing BLOB data and a column which keeps name of the file for that BLOB Data. You want that each BLOB data is saved to Physical Files with names as stored in "File Name" Column. This Documents details how to achieve this goal.

Prerequisite:
-----------
Consider a sample data as:


Table1
---------
filename        FileContent
myfile1.pdf      BLOB1
myfile2.pdf      BLOB2
myfile2.jpg      BLOB3

After running Export Wizard from SQL Developer, it should produce:

myfile1.pdf --> containing BLOB1 content
myfile2.pdf --> containing BLOB2 content
myfile3.jpg --> containing BLOB3 content

It is then assumed that BLOB content matches with the filename extension. For example BLOB1, BLOB2 are PDF format content and BLOB3 is an image content.
Script does not verify the content and assumes they are mapped correctly.

Disclaimer:
-----------
Please note:
This sample python script is for a Demonstration purpose only. This is not a part of SQL Dev product and not supported.
This is more like post processing with a workaround. You need to enhance script or choose any other alternative to achieve it.

There are other option such as running JavaScript from SQLcl.

 

 file_test.py

 

 

Solution

To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!


In this Document
Goal
Solution


My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.