oracle blob文本搜索

Ska*_*kay 18 oracle search blob

是否可以使用sql语句搜索blob文本?我可以从$ table中选择*,其中f1如'%foo%',如果f1是varchar,那么f1是一个blob怎么样?对此有何反击?

Ola*_*son 62

这很容易做到.

只需将dbms_lob.instr与utl_raw.cast_to_raw结合使用即可

因此,在您的情况下,如果t1是BLOB,则select将如下所示:

select *
  from table1
 where dbms_lob.instr (t1, -- the blob
                   utl_raw.cast_to_raw ('foo'), -- the search string cast to raw
                   1, -- where to start. i.e. offset
                   1 -- Which occurrance i.e. 1=first
                    ) > 0 -- location of occurrence. Here I don't care.  Just find any
;
Run Code Online (Sandbox Code Playgroud)

  • ++当数据库不是你的时候,说模式错误并不是全部.非常感谢你复活和回答这个问题! (5认同)

Gar*_*ers 5

如果是 Word 或 PDF 文档,请查看Oracle Text