Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

DBMS_LOB.INSTR - Searching for a pattern

320398Mar 28 2003 — edited Mar 28 2003
Hi

I have a program supporting several databases. F.ex SQL2000 and Oracle 8/9.

The field in question, text, might contain a lot of characters. In Oracle, it's a CLOB,
on SQL2000 it's a varchar. It is not possible for me to alter the database-structure in
any ways at this moment. The database-schema is locked.

My question is pretty simple, you have probably seen it before.

In SQL2000 I can use this query:

select count(*) from crm5.text where text like 'n%'.

The result returned = 8.

The same on Oracle will be somewhat like:

select count(*) from crm5.text where dbms_lob.instr( text, 'n') > 0

The result returned = 29.

The databases has the same data.

It seems to me that the dbms_lob.instr
does a (case-sensitive) query like this:

select count(*) from crm5.text where text like '%n%

Is this the right assumption? How can I get the correct number
of rows and do the search case-insensitive at the same time not
killing the performance of the database? We use a pretty smart
little thing on "normal" LIKE. But how can we do this with the
CLOB?

Regards,



Ivar
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 25 2003
Added on Mar 28 2003
2 comments
4,923 views