Re: Case insensitivity in LIKE query - possible?
From: Paul Zola <pzola_at_us.oracle.com>
Date: 1996/04/07
Message-ID: <4k8tmc$qn0_at_inet-nntp-gw-1.us.oracle.com>#1/1
Date: 1996/04/07
Message-ID: <4k8tmc$qn0_at_inet-nntp-gw-1.us.oracle.com>#1/1
In <4jf9vu$rr8_at_news.missouri.edu> pixel_at_rhino.coe.missouri.edu (James P. Cooper) writes:
} Hello,
}
} I'm using Oracle 7.1 on an SGI, and would like to perform some case
} insensitive queries using LIKE.
[snip]
SQL> select ename from emp where upper(ename) like 'SMIT%';
This leads to the second classic solution, which is somewhat more complex. This is:
where ( ename like 'SM%' or ename like 'Sm%' or ename like 'sM%' or ename like 'sm%' ) and upper(ename) like 'SMIT%';
The portion of the WHERE clause within the parentheses will allow the optimizer to use the index for a range scan, while not affecting the rows returned in the result set. This can dramatically improve the query performance.
-p
Paul Zola Technical Specialist World-Wide Technical Support Development Tools ============================================================================== Computers possess the truly profound stupidity of the inanimate. - B. Sterling Disclaimer: Opinions and statements are mine, and do not necessarily reflect the opinions of Oracle Corporation.Received on Sun Apr 07 1996 - 00:00:00 CEST