We have created a BLOB type column to store 6000 to 7000 ASCII characters of payload. I am inserting the payload using following code.
PreparedStatement stmt=conn.prepareStatement(insertQuery);
String record="My ASCII Payload";
stmt.setBytes(1, record.getBytes());
stmt.execute();
When i run below query i can see the length of chars in the output.
select dbms_lob.getLength(MY_PAYLOAD)
from RAW_DATA;
6085
I wanted to perform text search in this BLOB column , i tried following options nothing works. What is the correct way to perform text search in a BLOB column ?
SELECT * FROM RAW_DATA t
WHERE dbms_lob.instr(t.MY_PAYLOAD,utl_raw.cast_to_raw(‘1234’))>0
select *
from RAW_DATA
where dbms_lob.instr (MY_PAYLOAD, -- the blob
utl_raw.cast_to_raw ('1234'),
1, -- where to start. i.e. offset
1 -- Which occurrance i.e. 1=first
) > 0