How to convert blob data to text in oracle sql

This example will convert the data in BLOB_column to the type varchar2.

select UTL_RAW.CAST_TO_VARCHAR2(DBMS_LOB.SUBSTR(BLOB_column, 3200,1)) 
from tablename;

The function substr takes 3 parameters
1. The raw blob o clob data
2. The number of bytes (for BLOBs) or characters (for CLOBs) to be read.
3. The offset in bytes (for BLOBs) or characters (for CLOBs) from the start of the LOB (origin: 1).

It will return NULL, if:
-Any input parameter is null.
-Number of bytes < 1 -Number of bytes > 32767
-Offset < 1 -Offset > LOBMAXSIZE

Search within Codexpedia

Custom Search

Search the entire web

Custom Search