Hi All,

I executed the queries below on an oracle9i xmltype column with over 122K records. Searching for a value that is in the database results much faster than non existing value.

Query1: elapsed time 250 milliseconds
select e.xmlTypecol.getClobVal()
from repository e
where e.xmlTypecol,existsNode('/metadata/begining_date/year')=1
and e.xmlTypecol,extract('/metadata/beginning_date/year/text()').getNumberVal() > 2000;

Query2: elapsed time 18 minutes
same as above except "getNumberVal() > 2005" which is not in the database.

Since both queries use the method of searching, I don't understand why the first query is faster than the second query which is taking an unreasonable amount of time.

Any help will be appreciated.

Thanks in advance.