专栏首页Jerry的SAP技术分享SAP HANA里的中文排序问题

SAP HANA里的中文排序问题

版权声明:本文为博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。

本文链接:https://jerry.blog.csdn.net/article/details/100048705

I have a simple demo, I have create a table which contains 3 rows and they all have a column named"CNAME" to display their Chinese name. And for column ENAME, it displays their Chines name in pinyin.

DROP TABLE TEST_SORT;
CREATE TABLE TEST_SORT ( SID INTEGER,
CNAME NVARCHAR(100),
ENAME NVARCHAR(20));


INSERT INTO TEST_SORT Values (1, '山东', 'ShanDong');
INSERT INTO TEST_SORT Values (2, '华为', 'Huawei');
INSERT INTO TEST_SORT Values (3, '爱活力', 'Aihuoli');

You could open sql trace with result when you executing the sort statement:

 select * from TEST_SORT ORDER BY CNAME desc;

The result in sql trace shows that the Chinese name will be transfer to Hexadecimal character when they are stored in the system and the compare are in fact in these Hexadecimal character:

cursor_140298224832512_c136.execute(’’’ select * from TEST_SORT ORDER BY CNAME desc ‘’’)

end PreparedStatement_execute (thread 29569, con-id 300136) at 2017-09-11 15:54:31.140143

ResultSet.columnLabel = [SID:INTEGER, CNAME:NVARCHAR, ENAME:NVARCHAR] (thread 29569, con-id 300136) at 2017-09-11 15:54:31.140189

ResultSet.row[1] = [3, u’’’\xE7\x88\xB1\xE6\xB4\xBB\xE5\x8A\x9B’’’, u’’‘Aihuoli’’’] (thread 29569, con-id 300136) at 2017-09-11 15:54:31.140204

ResultSet.row[2] = [1, u’’’\xE5\xB1\xB1\xE4\xB8\x9C’’’, u’’‘ShanDong’’’] (thread 29569, con-id 300136) at 2017-09-11 15:54:31.140210

ResultSet.row[3] = [2, u’’’\xE5\x8D\x8E\xE4\xB8\xBA’’’, u’’‘Huawei’’’] (thread 29569, con-id 300136) at 2017-09-11 15:54:31.140216

Therefore, 爱活力 will be bigger than 山东 and 华为.

If you want to sort the Chinese character as you expected, I think the most convenient way is to add a column that display the Chinese name in pinyin and sort in that column.

本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。

我来说两句

0 条评论
登录 后参与评论

相关文章

  • 作为一个SAP开发人员,需要学习SAP传统技术(比如ABAP)以外的开源技术吗?

    I joined SAP China seven years ago after graduation and knew nothing about SAP o...

    Jerry Wang
  • 如何使用Cordova将SAP Fiori应用打包并安装到Android平台上

    There is a wonderful tutorial Building SAP Fiori-like UIs with SAPUI5 in 10 Exer...

    Jerry Wang
  • SAP CRM如何创建支持Web Service的PDF模板

    In my previous document Create Webservice enabled word document in attachment as...

    Jerry Wang
  • iCDO一周数据:腾讯Q3财报:支付等业务成主要营收;华为与亚马逊和谷歌竞争海外语音市场;京东获全球首个省域无人机物流经营许可证

    中国专利保护协会12日发布的《人工智能技术专利深度分析报告》(下称《报告》),对人工智能技术在世界范围内和在我国的专利申请数据进行了分析。 ...

    iCDO互联网数据官
  • SAP S/4 HANA新变化-COPA

    Profitability Analysis The universal journal (ACDOCA) is the heart of Accounting...

    SAP最佳业务实践
  • What is Human Resource Management System(HRMS)?

    What is Human Resource Management System (HRMS)? Why HRMS Software Development? ...

    用户4822892
  • 如何使用Cordova将SAP Fiori应用打包并安装到Android平台上

    There is a wonderful tutorial Building SAP Fiori-like UIs with SAPUI5 in 10 Exer...

    Jerry Wang
  • 实用手册:130+ 提高开发效率的 vim 常用命令

      Vim 是从 vi 发展出来的一个文本编辑器。代码补完、编译及错误跳转等方便编程的功能特别丰富,在程序员中被广泛使用。和 Emacs 并列成为类 Unix ...

    猿人谷
  • Protocol Buffer的使用(p

    安装完毕后,进入解压目录的python目录,执行python setup.py install;安装python的protobuf库即可。

    py3study
  • 为何JUC中有大量代码将成员变量复制到本地变量后再操作?

    总结:在性能核心部分,是有效果的(所以j.u.c和Netty大量这样搞)。 juc那么写是因为一开始就那么写(考虑到当时的jvm的现代化),而且单纯来看,loc...

    开发架构二三事

扫码关注云+社区

领取腾讯云代金券