Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: Working with a BLOB

Re: Working with a BLOB

From: Bill Pribyl <bill_at_datacraft.com>
Date: Wed, 30 May 2001 15:16:37 -0700
Message-ID: <F001.00314B8C.20010530150959@fatcity.com>

> 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;
/



http://www.datacraft.com/ http://plnet.org/
-- 
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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US