Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 319215
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T08:38:27+00:00 2026-05-12T08:38:27+00:00

I ran into a weird behavior from Oracle this morning… And I can’t understand

  • 0

I ran into a weird behavior from Oracle this morning… And I can’t understand why it acts this way from the docs. I’m sorry for the long post, but I want to make sure I’m understood. Oh, and make sure to read the note at the end before answering. 🙂

The goal of the request is to return rows with 1 or more lowercase characters. For the sake of the example, my table will be:

CREATE TABLE "TEMP_TABLE" 
   ( "VAL" VARCHAR2(4000 BYTE) );
Insert into TEMP_TABLE (VAL) values ('00A00');
Insert into TEMP_TABLE (VAL) values ('00000');
Insert into TEMP_TABLE (VAL) values ('BC000');
Insert into TEMP_TABLE (VAL) values ('ABC00');
Insert into TEMP_TABLE (VAL) values ('AAAAA');
Insert into TEMP_TABLE (VAL) values ('abc00');

Using this SQL query:

select val, 
  case when regexp_like (val, '[a-b]')
       then 'MATCH' 
       else 'NO' 
  end 
  from temp_table;

If the NLS_SORT value of the session is set to BINARY, Oracle returns:

00A00   NO
00000   NO
BC000   NO
ABC00   NO
AAAAA   NO
abc00   MATCH

All good here: the only word containing a lowercase letter matches – the others don’t.

But if NLS_SORT is set to FRENCH, the results are less understandable:

00A00   NO
00000   NO
BC000   MATCH
ABC00   MATCH
AAAAA   NO
abc00   MATCH

From what I can deduce, the regexp matches when there are characters other than A.

So my question is: Why would Oracle understand [a-z] as "rows with letters that are not A"?

Notes:

  1. The database is Oracle 10G(r2), and the session’s NLS parameters are these:

    NLS_CALENDAR             GREGORIAN
    NLS_COMP                 BINARY
    NLS_CURRENCY             ¿
    NLS_DATE_FORMAT          DD/MM/RR HH24:MI
    NLS_DATE_LANGUAGE        FRENCH
    NLS_DUAL_CURRENCY        ¿
    NLS_ISO_CURRENCY         FRANCE
    NLS_LANGUAGE             FRENCH
    NLS_LENGTH_SEMANTICS     BYTE
    NLS_NCHAR_CONV_EXCP      FALSE
    NLS_NUMERIC_CHARACTERS   , 
    NLS_SORT                 FRENCH_M
    NLS_TERRITORY            FRANCE
    NLS_TIME_FORMAT          HH24:MI:SSXFF
    NLS_TIMESTAMP_FORMAT     DD/MM/RR HH24:MI:SSXFF
    NLS_TIMESTAMP_TZ_FORMAT  DD/MM/RR HH24:MI:SSXFF TZR
    NLS_TIME_TZ_FORMAT       HH24:MI:SSXFF TZR
    
  2. Yes, I could use regexp_like(val, '[[:lower:]]'). But I found out about this later on, and it doesn’t explain the weird behaviour.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T08:38:28+00:00Added an answer on May 12, 2026 at 8:38 am

    For better or worse, the sort ordering defined by nls_sort is being used to evaluate the [a-z] regexp. If you insert a,b,c,A,B,C into temp_table and sort it under each setting you’ll get the following:

    SQL> alter session set nls_sort=BINARY;
    
    Session altered.
    
    SQL> select val,
      2  case when regexp_like (val, '[a-z]') then 'MATCH' else 'NO' end m
      3  from temp_table order by val;
    
    VAL           M
    ------------------------- -------------------------
    A             NO
    B             NO
    C             NO
    a             MATCH
    b             MATCH
    c             MATCH
    
    6 rows selected.
    
    SQL> alter session set nls_sort=FRENCH;
    
    Session altered.
    
    SQL> select val,
      2  case when regexp_like (val, '[a-z]') then 'MATCH' else 'NO' end m
      3  from temp_table order by val;
    
    VAL           M
    ------------------------- -------------------------
    A             NO
    a             MATCH
    B             MATCH
    b             MATCH
    C             MATCH
    c             MATCH
    
    6 rows selected.
    

    Since the uppercase letters are "interleaved" with the lowercase letters in the French setting it evaluates to true in Oracle’s implementation.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I ran into this weird bug or something in android's 4.0.1 Ice Cream Sandwitch,
I was creating a form validator for a client and ran into this weird
Ran into some weird behaviour and wondering if anyone else can confirm what I
I ran into this situation that is weird, in order to kill the zombie
I've ran into a weird issue today, I'm hoping someone else can help me
I ran into a weird situation today doing some one-time sql code. This nested
Today, I ran into this weird problem with a user using Mac OS X.
I ran into a weird problem today that I don't really fully understand. Hopefully
I've ran into a weird issue when ever I deploy to my winhost account
Today I ran into something a bit weird. I used mini-profiler to see the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.