I want to use REGEXP_INSTR()
within an oracle database to check for lower/uppercase characters. I\'m aware of [:upper:]
and [:lower:]
POSI
The reason for the behavior is the collation rules. See the NLS_SORT documentation:
- If the value is BINARY, then the collating sequence for ORDER BY queries is based on the numeric value of characters (a binary sort that requires less system overhead).
- If the value is a named linguistic sort, sorting is based on the order of the defined linguistic sort. Most (but not all) languages supported by the NLS_LANGUAGE parameter also support a linguistic sort with the same name.
Set the NLS_SORT
to BINARY
so that the [A-Z]
could be parsed in the same order as in the ASCII table,
alter session set nls_sort = 'BINARY'
Then, you will get consistent results.
See the online demo.