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 7042399
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T02:09:49+00:00 2026-05-28T02:09:49+00:00

I have a table in an Oracle Database like this ID | LABEL ————

  • 0

I have a table in an Oracle Database like this

ID   | LABEL
------------
 1   |  label alpha 1
 2   |  label alpha 2
 3   |  label alpha a

when I do a select in an application like Squirrel like this :

select * FROM MA_TABLE order by LABEL asc

I get :

ID   | LABEL
------------
 1   |  label alpha 1
 2   |  label alpha 2
 3   |  label alpha a

which is fine !

but When I execute the same request using MyBatis :

<select id="selectMaTable" resultMap="resultMap" >
  Select * FROM MA_TABLE order by LABEL asc
</select>

I get :

ID   | LABEL
------------
 3   |  label alpha a
 1   |  label alpha 1
 2   |  label alpha 2

The alphabetic characters come before the numeric characters… why ??

thanks in advance,

Antoine

Ps : I am using org.mybatis:mybatis:jar:3.0.5 and com.oracle:ojdbc6:jar:11.2.0.2.0 for database access

Edit :
this linked help me a bit also

Thanks to Soulcheck’s remark, I found that if I change the order by clause with ORDER BY NLSSORT(ATL_SIT.ATL_SIT_LIB, ‘NLS_SORT=BINARY’) it works…

Does anyone knows how to force NLS_SORT=BINARY with myBatis ?
(It is already set on my Oracle database in NLS_DATABASE_PARAMETERS)

  • 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-28T02:09:50+00:00Added an answer on May 28, 2026 at 2:09 am

    It looks like it might be a locale issue. Connect with squirrel and check what NLS_LANG it sets, then check what locale uses your java app. Another parameter that can influence sort is NLS_SORT.

    You can check the value of both by issuing:

    select parameter,value from NLS_DATABASE_PARAMETERS where parameter in('NLS_LANGUAGE','NLS_SORT');
    

    Then you can test it in java by using:

    Locale.getDefault()
    

    and set it by using:

    Locale.setDefault(Locale)
    

    or by adding jvm parameters:

    -Duser.country=en -Duser.language=en
    

    edit

    spring forums recommend creating a logon trigger which sets NLS_SORT environmental variable on user logon. It’s not MyBatis, but jdbc anyway so should work in your case.

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

Sidebar

Related Questions

I have come across a query like this in a database: SELECT col_a FROM
I have created a table on an Oracle 10g database with this structure :
I have stored-procedure in Oracle database like this: create or replace PROCEDURE EDYTUJ_PRACOWNIKA (PR_IMIE
I have optimized a complex Oracle statement using temporary table like this : original
I have a Oracle database table like so, which records an item being scanned
I have a table (in an Oracle database) just like below: department ---------- Finance
I have a table (Oracle database) that looks like: CREATE TABLE example ( idEx
I have a mySQL query to get columns from a table like this: String
we have a table in an Oracle Database which contains a column with the
I have a table in an Oracle Database that has, among others, a DATE

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.