I am trying to see from an SQL console what is inside an Oracle BLOB.
I know it contains a somewhat large body of text and I want to just see the text, but the following query only indicates that there is a BLOB in that field:
select BLOB_FIELD from TABLE_WITH_BLOB where ID = '<row id>';
the result I'm getting is not quite what I expected:
BLOB_FIELD ----------------------- oracle.sql.BLOB@1c4ada9
So what kind of magic incantations can I do to turn the BLOB into it's textual representation?
PS: I am just trying to look at the content of the BLOB from an SQL console (Eclipse Data Tools), not use it in code.
Use
TO_CHAR
function.Converts
NCHAR
,NVARCHAR2
,CLOB
, orNCLOB
data to the database character set. The value returned is alwaysVARCHAR2
.Barn's answer worked for me with modification because my column is not compressed. The quick and dirty solution:
You can use below SQL to read the BLOB Fields from table.
SQL Developer provides this functionality too :
Double click the results grid cell, and click edit :
Then on top-right part of the pop up , "View As Text" (You can even see images..)
And that's it!
If you want to search inside the text, rather than view it, this works:
I struggled with this for a while and implemented the PL/SQL solution, but later realized that in Toad you can simply double click on the results grid cell, and it brings up an editor with contents in text. (i'm on Toad v11)