本文介绍了oracle中的varchar2排序如何工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在按Varchar2列对Oracle SQL查询进行排序.但是,当我得到结果时,我无法正确理解顺序.这是逻辑顺序.前较低的字母?数字?符号?在这里,我附上了其中一项测试的结果顺序:

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

FieldToOrder为VARCHAR2列

being FieldToOrder a VARCHAR2 column

FieldToOrder:

"77777777777"//第一个字符为空格

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

"aaas"

"_ aad"

"AADD"

"A00004AAAA9999"

"A00004AAAA9999"

"ref11"

"ref22"

"0000000002222"

"0000000002222"

关于逻辑顺序是什么的任何想法?谢谢,

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

推荐答案

这取决于客户端上的环境变量NLS_LANG.请参见NLS_SORT 上的此参考.

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

这篇关于oracle中的varchar2排序如何工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!