Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Searching CLOBS case insensitive

748 views
Skip to first unread message

Petri

unread,
Dec 18, 2002, 4:12:20 PM12/18/02
to
I am trying to search a CLOB field case insensitively. I am currently
using dbms_lob.instr() but this function is case sensitive. Does
anyone know how to search case insensitively?

Howard J. Rogers

unread,
Dec 18, 2002, 4:26:27 PM12/18/02
to
Probably not what you're after, but:

SQL> create table clobtest (
2 col1 clob);
Table created.
SQL> insert into clobtest values ('I am a CLOB');
1 row created.
SQL> commit;
Commit complete.

SQL> select * from clobtest where upper(col1) like '%AM%';

COL1
----------------------------------------------------------

I am a CLOB

Regards
HJR

"Petri" <Pet...@hotmail.com> wrote in message
news:b4803f2d.02121...@posting.google.com...

Pablo Sanchez

unread,
Dec 18, 2002, 4:26:59 PM12/18/02
to
Pet...@hotmail.com (Petri) wrote in
news:b4803f2d.02121...@posting.google.com:

> I am trying to search a CLOB field case insensitively. I am
> currently using dbms_lob.instr() but this function is case
> sensitive. Does anyone know how to search case insensitively?

Unless you plan on having very few CLOB searches, you might want to
instead use the Intermedia/Context cartridge to do this activity.
--
Pablo Sanchez, High-Performance Database Engineering
http://www.hpdbe.com

Petri

unread,
Dec 19, 2002, 9:12:09 AM12/19/02
to
Pablo Sanchez <pa...@dev.null> wrote in message news:<Xns92E892FD6AB37...@209.242.64.107>...

> Pet...@hotmail.com (Petri) wrote in
> news:b4803f2d.02121...@posting.google.com:
>
> > I am trying to search a CLOB field case insensitively. I am
> > currently using dbms_lob.instr() but this function is case
> > sensitive. Does anyone know how to search case insensitively?
>
> Unless you plan on having very few CLOB searches, you might want to
> instead use the Intermedia/Context cartridge to do this activity.

How would I use the Intermedia/Context cartridge? Do you know where I
could find an example?

John Russell

unread,
Dec 20, 2002, 12:49:49 AM12/20/02
to

These days it's known as Oracle Text. You create a special kind of
index, then you use the CONTAINS( ) function in the query to check for
the existence of words, phrases, boolean expressions, etc.

Here are the manuals (App Dev Guide and Reference):

http://otn.oracle.com/pls/db92/db92.docindex?remark=homepage#index-TEX

John

Vladimir M. Zakharychev

unread,
Dec 23, 2002, 8:01:56 AM12/23/02
to
Basically, you create an index with indextype ctxsys.context specifying
necessary parameters to it, something like this:

create index ctx_mytable on mytable (clob_col)
INDEXTYPE IS CTXSYS.CONTEXT [PARAMETERS '...']
/

and when it's online (may take quite some time if created on populated
table since DR will need to filter each CLOB and break it down into tokens,
record these tokens in its own tables and do some other things, like
theme extraction, if requested in index parameters), you query the table
like this:

select whatever from mytable
where CONTAINS(CLOB_COL,'my search term',1) > 0

(the third parameter, which is 1 here but may be any number) allows you
to identify this particular operator for result scoring:

select whatever from mytable
where ( CONTAINS(CLOB_COL,'my search term',1) > 0
and SCORE(1) > 35 )
or (CONTAINS(CLOB_COL,'ABOUT(some theme)',2) > 0
and SCORE(2) > 50 )

To find out more, please refer to interMedia Text (8i)/Oracle Text (9i)
documentation.

--
Vladimir Zakharychev (b...@dpsp-yes.com) http://www.dpsp-yes.com
Dynamic PSP(tm) - the first true RAD toolkit for Oracle-based internet applications.
All opinions are mine and do not necessarily go in line with those of my employer.


"Petri" <Pet...@hotmail.com> wrote in message
news:b4803f2d.02121...@posting.google.com...

Petri

unread,
May 19, 2003, 11:16:46 AM5/19/03
to

Is this type of index available in 8i or only 9i?

--
Posted via http://dbforums.com

Vladimir M. Zakharychev

unread,
May 19, 2003, 2:08:16 PM5/19/03
to
"Petri" <membe...@dbforums.com> wrote in message news:2897023.1...@dbforums.com...

>
> Is this type of index available in 8i or only 9i?
>

Yes, CTXSYS.CONTEXT index type is available on 8i. Each new release
usually adds some new functionality and support for quite a few new
document formats (if you store documents in various formats, like Word
or WordPerfect, in BLOB columns) through newer INSO filters, plus usual
bugfixes and minor internal tweaks, but basic capabilities are the same.

As I suggested earlier, refer to Oracle interMedia Text reference for more
details on this feature (that's for 8i, in 9i it was renamed to Oracle Text.)
You can find complete searchable docs here: http://tahiti.oracle.com

0 new messages