{"id":578,"date":"2012-11-30T09:17:30","date_gmt":"2012-11-30T09:17:30","guid":{"rendered":"http:\/\/bar-solutions.com\/weblog\/?p=578"},"modified":"2012-11-30T09:17:30","modified_gmt":"2012-11-30T08:17:30","slug":"","status":"publish","type":"post","link":"https:\/\/blog.bar-solutions.com\/?p=578","title":{"rendered":"Case-Insensitive&#8230;"},"content":{"rendered":"<p align=\"left\">When building your queries you might want to search case-insensitive. We normally use the UPPER() function to accomplish this. This is kind of weird IMHO, because you have to uppercase the value you are looking for. I was wondering why we are not using the LOWER() function. I put this question on Twitter the other day and got a lot of replies right away.<\/p>\n<p><!--more--><\/p>\n<p align=\"right\"><a href=\"http:\/\/twitter.com\/fritshoogland\"><img loading=\"lazy\" decoding=\"async\" alt=\"fritshoogland&#39;s avatar\" src=\"http:\/\/bar-solutions.com\/weblog\/img\/Case-Insensitive\/@fritshoogland.png\" width=\"48\" height=\"48\" \/> <\/a><\/p>\n<p align=\"right\"><b>Frits Hoogland<\/b> @fritshoogland <\/p>\n<p align=\"right\">\n<\/p>\n<p align=\"right\"><a href=\"http:\/\/twitter.com\/patch72\">@patch72<\/a> AFAIK, old computer systems registered everything in uppercase. I know of old govmt systems. prbly people just kept on doing that.<\/p>\n<p align=\"left\">That would be a very plausible explanation. We do a lot of things in a special way because we are used to doing it like that.<\/p>\n<p><p align=\"right\"><img loading=\"lazy\" decoding=\"async\" alt=\"alexnuijten&#39;s avatar\" src=\"http:\/\/bar-solutions.com\/weblog\/img\/Case-Insensitive\/@alexnuijten.png\" width=\"48\" height=\"48\" \/> <\/p>\n<p align=\"right\"><b>Alex Nuijten<\/b> @alexnuijten <\/p>\n<p align=\"right\">\n<\/p>\n<p align=\"right\"><a href=\"http:\/\/twitter.com\/patch72\">@patch72<\/a> wouldn&#8217;t lower() introduce special characters like accents? With upper() this will not happen. <a href=\"http:\/\/twitter.com\/fritshoogland\">@fritshoogland<\/a><\/p>\n<p align=\"left\">I don&#8217;t think this will happen. Using a special character like an accent on a character should keep that accent in both upper and lower case.<\/p>\n<p align=\"right\"><a href=\"http:\/\/twitter.com\/jurgen_k\"><img loading=\"lazy\" decoding=\"async\" alt=\"jurgen_k&#39;s avatar\" src=\"http:\/\/bar-solutions.com\/weblog\/img\/Case-Insensitive\/@jurgen_k.JPG\" width=\"48\" height=\"48\" \/> <\/a><\/p>\n<p align=\"right\"><b>Jurgen Kemmelings<\/b> @jurgen_k <\/p>\n<p align=\"right\">\n<\/p>\n<p align=\"right\"><a href=\"http:\/\/twitter.com\/alexnuijten\">@alexnuijten<\/a> <a href=\"http:\/\/twitter.com\/patch72\">@patch72<\/a> ik snap het niet? SQL&gt; select upper(&#8216;h\ufffd\ufffd&#8217;) from dual; UPPER &#8212;&#8211; H\u0554EL <\/p>\n<ul>\n<li>\n<div align=\"left\">If you run this query it is like I expected. The accent is preserved.<\/div>\n<\/li>\n<\/ul>\n<p><p align=\"right\"><img loading=\"lazy\" decoding=\"async\" alt=\"MarcelHoefs&#39;s avatar\" src=\"http:\/\/bar-solutions.com\/weblog\/img\/Case-Insensitive\/@MarcelHoefs.jpg\" width=\"48\" height=\"48\" \/><\/p>\n<p align=\"right\"><b>Marcel Hoefs<\/b> @MarcelHoefs<\/p>\n<p align=\"right\">\n<\/p>\n<p align=\"right\"><a href=\"http:\/\/twitter.com\/patch72\">@patch72<\/a> <a href=\"http:\/\/twitter.com\/alexnuijten\">@alexnuijten<\/a><a href=\"http:\/\/twitter.com\/jurgen_k\">@jurgen_k<\/a> Of: SELECT NLS_UPPER(&#8216;gro\u0825&#8217;, &#8216;NLS_SORT = XGerman&#8217;) nls_uppercase, UPPER(&#8216;gro\u0825&#8217;) uppercase FROM DUAL;<\/p>\n<ul>\n<li>\n<div align=\"left\">This query will replace the \u07e0character by SS, but this is more a translation of the text. So it&#8217;s not just a case change (to UPPER) but also removing all special characters.<\/div>\n<\/li>\n<\/ul>\n<p>One of the most funny replies is this one:<\/p>\n<p align=\"right\"><a href=\"http:\/\/twitter.com\/cczarski\"><img loading=\"lazy\" decoding=\"async\" alt=\"cczarski&#39;s avatar\" src=\"http:\/\/bar-solutions.com\/weblog\/img\/Case-Insensitive\/@cczarski.png\" width=\"48\" height=\"48\" \/><\/a><\/p>\n<p align=\"right\"><a href=\"http:\/\/twitter.com\/cczarski\"><b>Carsten Czarski<\/b>@cczarski<\/a><\/p>\n<p align=\"right\"><a href=\"http:\/\/twitter.com\/patch72\">@patch72<\/a> I always used upper(lower()) &#8230; to be sure \ud83d\ude42<\/p>\n<p>The idea is exactly the opposite. I don&#8217;t want to type the uppercase characters in my query. It involves keeping the shift key pressed (or enabling the CAPS LOCK), so using lower(upper()) would make more sense IMHO.<\/p>\n<p>There were some more comments, but you can look them up yourself using this <a title=\"Twitter messages mentioning patch72\" href=\"https:\/\/twitter.com\/search?q=patch72&amp;src=typd\" rel=\"nofollow\" target=\"_blank\">link<\/a>.<\/p>\n<p>Any other ideas on why this is? Please use the comments \ud83d\ude09<\/p>\n","protected":false},"excerpt":{"rendered":"<p>When building your queries you might want to search case-insensitive. We normally use the UPPER() function to accomplish this. This is kind of weird IMHO, because you have to uppercase the value you are looking for. I was wondering why we are not using the LOWER() function. I put this question on Twitter the other [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,5,9],"tags":[],"class_list":["post-578","post","type-post","status-publish","format-standard","hentry","category-oracle","category-plsql","category-sql"],"_links":{"self":[{"href":"https:\/\/blog.bar-solutions.com\/index.php?rest_route=\/wp\/v2\/posts\/578","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.bar-solutions.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.bar-solutions.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.bar-solutions.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.bar-solutions.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=578"}],"version-history":[{"count":0,"href":"https:\/\/blog.bar-solutions.com\/index.php?rest_route=\/wp\/v2\/posts\/578\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.bar-solutions.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=578"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.bar-solutions.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=578"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.bar-solutions.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=578"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}