October 22, 2024
Chicago 12, Melborne City, USA
SQL

How to visualize properly BLOB on Oracle SQL?


I have BLOB columns in an Oracle Database that come from an IBM AS400 Database.

The raw data look like (this is litterally what i have from my column (for column Data Type and and a row value)) :

(BLOB)

I’m looking to visualize these BLOBs in a simple query. I mainly used these two methods :

SELECT
    DBMS_LOB.SUBSTR(<BLOB_OBJECT>, 4000, 1) AS DBMS_SUBSTR_4000,
    UTL_RAW.CAST_TO_VARCHAR2(DBMS_LOB.SUBSTR(<BLOB_OBJECT>, 2000, 1)) AS VARCHAR2_SUBSTR
FROM
    <BLOB_TABLE>;

Here the result :

DBMS_SUBSTR_4000 VARCHAR2_SUBSTR
40 @
A5 �@
A5 �@
C4 ��
C4 ��
C4 ��
C4 ��
C4 ��

The result should look something like this (to be precise, the example below shows values coming from an AS400 database before being incorporated into an Oracle database) :

DBMS_SUBSTR_4000 VARCHAR2_SUBSTR
00 00
01 01
55 55
56 56
01 01
01 01
00 00
00 00

I have tried various methods to properly display these BLOB objects. I want to copy the table containing BLOBs into a new table, but without the BLOB data. Instead, I want to convert the BLOB values.



You need to sign in to view this answers

Leave feedback about this

  • Quality
  • Price
  • Service

PROS

+
Add Field

CONS

+
Add Field
Choose Image
Choose Video