How does varchar2 sorting in oracle works?

余生颓废 提交于 2019-12-11 04:30:47

问题


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 ordering 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,


回答1:


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



来源:https://stackoverflow.com/questions/5218560/how-does-varchar2-sorting-in-oracle-works

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!