exclamation point in sql
I have an application and it sometimes uses sql that has the below.
SELECT T194.C1,C179,C200000020,C210000000,C200000003,C200000004,C200000005,C490021100,C1000000001,C240001002,C240001005,C400129200
FROM T194 WHERE (
(
(((T194.C210000000 LIKE ('wsp' || '%'))AND (0 = 0)) OR ('wsp' = ' '))
AND (((T194.C200000020 LIKE (' ' || '%')) AND (0 = 0)) OR (' ' = ' '))
AND (T194.C400127400 = 'ATT.TICKETING')
AND (T194.C400129100 = 0)
AND (1 = 1)
AND (T194.C179 != 'OI-38B8EB16E3B711DEA613000084A752D8')
)
ORDER BY 1 ASC
When I do the query it takes 90 secs, but if I change T194.C179 != to T194.C179 = , remove the ! it takes 2 seconds to run and uses the correct index. It appears the ! does a wild search on the column C179. I've never messed with ! so not sure why it is in the sql in the 1st place.
Any thoughts on why the application would use ! would be helpfull.
Thanks
Edited by: NeedHelpDBA on Mar 16, 2010 7:54 AM