Link to home
Start Free TrialLog in
Avatar of Evan Cutler
Evan CutlerFlag for United States of America

asked on

Clob operation in oracle

Greetings ee warriors.

I have a text larger than 4000 characters.  Nominally I would use varchar but varchar limits to 4000.  In this case I need to run a near function on a clobber.

I have two words and I need to know if they are near each other....but like I said, in a clobber datatype.

Help?
Thx
Avatar of slightwv (䄆 Netminder)
slightwv (䄆 Netminder)

Create a Text index.

Then to check if they are withing 5 words of each other and word1 is LEFT of word2:

select some_column form table where contains(clob_column,'near((word1,word2),5,TRUE)') > 0;


You might also get away with some regular expressions if running 10g or above:

something like (untested) for 50 to 100 charactrers:

select some_column where regexp_instr(clobcolumn,'(word1)(.{50,100})(word2)') > 0;
Avatar of Evan Cutler

ASKER

Is true left? If so, what's right?  And in either direction?
True for the preserve flag means the terms must appear in the order provided.

For right, reverse the words?

To say any order, use false.
ASKER CERTIFIED SOLUTION
Avatar of slightwv (䄆 Netminder)
slightwv (䄆 Netminder)

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks...
one more question...
what's the >0 mean?
Appreciate it.
The online docs are your friend.

Check the return values in the docs for CONTAINS and REGEXP_INSTR.  If you still need help, just ask.

http://download.oracle.com/docs/cd/E11882_01/text.112/e24436/csql.htm#CCREF0104

http://download.oracle.com/docs/cd/E11882_01/olap.112/e17122/dml_functions_2067.htm#OLADM1851
Your awesome...
thanks.
Glad to help.

I guess I should have pointed out that the regexp_instr examples do not require the Text index.  Only the contains examples do.
cool.
Appreciate it.