19

How can I search in (put condition on) blob field in oracle, like text fields?

I need someting like:

select * from table_name where blob_field like '%00ff00ff%'

Oracle throws some error on it.

1

2 Answers 2

30

You can use dbms_lob.instr for this purpose i.e.

   select * from table_name 
   where dbms_lob.instr(blob_field, utl_raw.CAST_TO_RAW('00ff00ff'), 1, 1) > 0
2
  • 3
    The pattern for searching BLOBs has to be a RAW datatype. Oh, and I corrected the package name in the sample too ;)
    – APC
    Jan 2, 2011 at 12:26
  • Thank you, that was very helpful (came across this a year after you answered!) Oct 3, 2012 at 20:03
0
select *
from NDF_MODEL_PARAM
where dbms_lob.instr(VALUE, 'NaN') > 0;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.