Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: Working with a BLOB
> All I need to do is determine
> if a particular string ('.com') pattern exists in the
> column, within the first 75 bytes, and return its
> starting position.
The secret is the built-in DBMS_LOB.INSTR.
Haven't actually run this code, but something along these lines ought to work:
DECLARE
lobloc BLOB;
rawstr RAW := UTL_RAW.CAST_TO_RAW('.com'); /* notice, case sensitive!
*/
pos PLS_INTEGER;
BEGIN
SELECT lobcol INTO lobloc WHERE primary_key = 'whatever';
pos := DBMS_LOB.INSTR(lobloc, rawstr);
IF pos > 0 and pos <= 75
THEN
DBMS_OUTPUT.PUT_LINE('found it!');
END IF;
END;
/
-- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Bill Pribyl INET: bill_at_datacraft.com Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051 San Diego, California -- Public Internet access / Mailing Lists -------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).Received on Wed May 30 2001 - 17:16:37 CDT
![]() |
![]() |