HEX dump of BLOB field 
Author Message
 HEX dump of BLOB field
Hi -
Anyone know how to get a Hex-dump of a BLOB field in Oracle 8i PL/SQL?
(Would like to use this in SQL+).

I'm aware of  a RAWTOHEX() function that will do this for the RAW type;
unsure why this does not exist for BLOB - surely there is a developer tool
to do this.

Thanks for any info -
Kent



Wed, 17 Dec 2003 08:01:11 GMT
 HEX dump of BLOB field


Quote:

>Hi -
>Anyone know how to get a Hex-dump of a BLOB field in Oracle 8i PL/SQL?
>(Would like to use this in SQL+).

>I'm aware of  a RAWTOHEX() function that will do this for the RAW type;
>unsure why this does not exist for BLOB - surely there is a developer tool
>to do this.

>Thanks for any info -
>Kent

just use dbms_lob.substr and pick off any 2000 byte or less (4000 characters is
a SQL limit, 2000 bytes = 4000 characters of hex) substr you want:


Table created.



  2          l_data raw(255);
  3  begin
  4          for i in 1 .. 255
  5          loop
  6                  l_data := l_data || hextoraw( to_char(i,'fmxx') );
  7          end loop;
  8  
  9          insert into t values ( l_data );
 10  end;
 11  /

PL/SQL procedure successfully completed.




X
--------------------------------------------------------------------------------
0102030405060708090A0B0C0D0E0F10111213141516171819

If you want to see the actual "blob" you can use utl_raw:


32 ) ) x from t;

X
--------------------------------------------------------------------------------
 !"#$%&'()*+,-./012345678

if utl_raw is not installed in your database, simply:

o cd $ORACLE_HOME/rdbms/admin
o log into svrmgrl using SYS or internal


--

Expert one on one Oracle, programming techniques and solutions for Oracle.
http://www.amazon.com/exec/obidos/ASIN/1861004826/  
Opinions are mine and do not necessarily reflect those of Oracle Corp



Wed, 17 Dec 2003 09:34:01 GMT
 
 [ 2 post ] 

 Relevant Pages 

1. Dumping data in BLOB field

2. BLOB, base64, not hex

3. Displaying Oracle's BLOB or Sybase's binary objects as hex digits

4. Displaying Oracle's BLOB or Sybase's binary objects as hex digits

5. store hex - NO hex conversion?

6. Hex to Decimal and Decimal to Hex conversion

7. Inserting a BLOB into an Oracle BLOB field.

8. Need to convert hex field to long int

9. Hex in Identity Field?

10. Lost oid restoring dump with blobs

11. Saving TMemo field data to a Blob field (Interbase Table) via SQL Update Query

12. Field not a BLOB field


 
Powered by phpBB® Forum Software