SQL oracle中二进制字段(blob)上的条件(如“like”)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4577986/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-01 08:44:31  来源:igfitidea点击:

Conditions (like "like") on binary field (blob) in oracle

sqloraclesearchfull-text-searchblob

提问by Polygon

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

如何在 oracle 中的 blob 字段(如文本字段)中搜索(设置条件)?

I need someting like:

我需要类似的东西:

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

Oracle throws some error on it.

Oracle 会抛出一些错误。

回答by Michael Pakhantsov

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

您可以为此目的使用 dbms_lob.instr ,即

   select * from table_name 
   where dbms_lob.instr(blob_field, utl_raw.CAST_TO_RAW('00ff00ff'), 1, 1) > 0