Define BLOB
sql> CREATE TABLE TESTTAB(A BLOB)
INSERT BLOB
sql> INSERT INTO TESTTAB VALUES(HEXTORAW('61626364')); sql> INSERT INTO TESTTAB VALUES(UTL_RAW.CAST_TO_RAW('ABCD')); sql> SELECT A FROM TESTTAB; A -------------------------------------------------------------------------------- 61626364 41424344
Operate on BLOB
sql> SELECT DBMS_LOB.SUBSTR(A) FROM TESTTAB; DBMS_LOB.SUBSTR(A) -------------------------------------------------------------------------------- 61626364 41424344 sql> SELECT DBMS_LOB.SUBSTR(A,DBMS_LOB.GETLENGTH(A) - 1) FROM TESTTAB; DBMS_LOB.SUBSTR(A,DBMS_LOB.GETLENGTH(A)-1) -------------------------------------------------------------------------------- 616263 414243 sql> SELECT UTL_RAW.CAST_TO_VARCHAR2(DBMS_LOB.SUBSTR(A)) FROM TESTTAB; UTL_RAW.CAST_TO_VARCHAR2(DBMS_LOB.SUBSTR(A)) -------------------------------------------------------------------------------- abcd ABCD