LIKE with COLLATION and ESCAPE

From: Martin Berger <martin.a.berger_at_gmail.com>
Date: Fri, 26 Feb 2021 20:34:28 +0100
Message-ID: <CALH8A92mwmB7o1+fUAGj=AB73M4nM3SJNKf96MDUZDsw=BfRCw_at_mail.gmail.com>



Hi List,

Yesterday I was confronted with an interesting question they faced. They have some entries in a varchar2 column such as _A, _B, _Ä, _, A
The LIKE pattern is '\_%' ESCAPE '\'
when NLS_COMP is LINGUISTIC and NLS_SORT is set to GERMAN_AI this LIKE doesn't return any rows.

My suggested workaround is to use
('\_%' COLLATE GERMAN_AI ) escape '\'
But I can't explain, why this is required to make the % work as I expect. Why % is sensitive of the collation?

Can anyone give me a hint, please?

A simple testcase can be found at
https://livesql.oracle.com/apex/livesql/s/lfcf58k7cj18t22jeth3rz6cu

thank you,
 Martin

-- 
Martin Berger                Oracle ♠
martin.a.berger_at_gmail.com _at_martinberx <https://twitter.com/martinberx>
^∆x      http://berxblog.blogspot.com

--
http://www.freelists.org/webpage/oracle-l
Received on Fri Feb 26 2021 - 20:34:28 CET

Original text of this message