此问题已在此处有答案:
how to sort by case insensitive alphabetical order using COLLATE NOCASE(3个答案)
Order by case insensitive in oracle(2个答案)
上个月关门了。
我想按L5_ORDERBY
表的名称列获得结果顺序,但它给了我错误的顺序
CREATE TABLE L5_ORDERBY
(
LVL NUMBER,
NAME VARCHAR2(10)
);
INSERT INTO L5_ORDERBY VALUES (-20, 'j');
INSERT INTO L5_ORDERBY VALUES (-30, 'H');
INSERT INTO L5_ORDERBY VALUES (12, 'G');
INSERT INTO L5_ORDERBY VALUES (30, 'f');
INSERT INTO L5_ORDERBY VALUES (1, 'e');
INSERT INTO L5_ORDERBY VALUES (1, 'e');
INSERT INTO L5_ORDERBY VALUES (6, 'E');
INSERT INTO L5_ORDERBY VALUES (1, 'E');
INSERT INTO L5_ORDERBY VALUES (4, 'c');
INSERT INTO L5_ORDERBY VALUES (3, 'c');
INSERT INTO L5_ORDERBY VALUES (5, 'b');
SELECT *
FROM L5_ORDERBY
ORDER BY NAME DESC;
这是我得到的结果:
| LVL|名称|
| --|--|
| -20| J|
| 30 |H|
| 12 |G|
| 30 |F|
| 1 |e|
| 1 |e|
| 6 |E|
| 1 |E|
| 4 |C|
| 3 |C|
| 5 |B|
Oracle返回的结果按名称排序错误
1条答案
按热度按时间t5fffqht1#
是的;只要你具体说明“错误顺序”是什么意思。我假设你想做区分大小写排序。如果是这样,那么:
您当前的输出:
更改
nls_sort
新结果:
如果要恢复更改,则
更多关于它的文档。
如果你在12 c及以上,使用
collate
: