We were having a requirement to upload word document in database BLOB field and then to search a string from it.
When we tried to search the string in MYSQL database using the like clause, it worked fine. We were using MYSQL in development mode. But our production was in oracle and when we run the same query in oracle it failed. Hence, we found something for oracle.
In oracle there is a package called dbms_lob, which operates on the blob and clob. This package has a function called instr. This function is used to search string in BLOB.
Eg: SELECT blob_column FROM table
WHERE dbms_lob.INSTR(blob_column, utl_raw.cast_to_raw('stringtofind'),1,1) > 0
No comments:
Post a Comment