开发者

How does varchar2 sorting in oracle works?

开发者 https://www.devze.com 2023-02-15 10:45 出处:网络
I\'m sorting a Oracle SQL query by a Varchar2 column. But when I get the results i can not correctly understand the ordering. Which is the logical order. first lower letters? numbers? symbols?. Here I

I'm sorting a Oracle SQL query by a Varchar2 column. But when I get the results i can not correctly understand the ordering. Which is the logical order. first lower letters? numbers? symbols?. Here I attach the resulting orderin开发者_如何学编程g of one of the tests:

select FieldToOrder from MyTable order by FieldToOrder ASC

being FieldToOrder a VARCHAR2 column


FieldToOrder:

" 77777777777" //The first character is a blank space

"aaas"

"_aad"

"AADD"

"A00004AAAA9999"

"ref11"

"ref22"

"0000000002222"


Any ideas of what's the logical order? Thanks,


It depends on the environment variable NLS_LANG on your client side. See this reference on NLS_SORT.

0

精彩评论

暂无评论...
验证码 换一张
取 消