Unreal user
Unreal user

Reputation: 1135

Oracle - Selective search in a clob

I have a clob colum, which stores values like -

Row1: <tag name="sdsdf"> Decent <tag name="dfgdfg"> Brag <tag name="dfgdsg"> Nice
Row2: <tag name="dfgsdfg"> Innocent <tag name="dfgds"> Cruel 

Basically, some values separated by tags. If I query for keyword "ag", I only want to get Row 1. I would like to ignore anything that's inside < and >.

Upvotes: 0

Views: 83

Answers (2)

eckes
eckes

Reputation: 10423

The Oracle Text extension can be used to build information retrieval (full text) index on CLOB data. If you dont use that, you have to do a slow linear substring search. You should avoid that and rethink your architecture (unless of course you talk only about a few MB data total).

Upvotes: 1

vav
vav

Reputation: 4684

that brakes down to 2 conditions in a loop:

  1. 'ag' in a string
  2. there is no > between position of 'ag' and position of next <
  3. repeat for every 'ag'

Can you write it?

or you can write a regexp using regexp_like(string, pattern).

Upvotes: 0

Related Questions