spring-data-jpa 土耳其语文本的Oracle Db排序问题

wbgh16ku  于 2022-11-10  发布在  Spring
关注(0)|答案(1)|浏览(107)

We're developing project with Spring Boot (JPA-Spring-Data) and Oracle Db. When trying to sort column which includes text, oracle gives me wrong sorting for Turkish Chars. Liquibase is our db migration tool.
This is a script for creation of table's column;

<column name="CONTENT" type="VARCHAR2(255 char)">
 <constraints nullable="false"/>
</column>

Entitys property;

@Column(name = "CONTENT", nullable = false)
private String content;

When trying to order by Content; The result looks like below

But for example; İngilizceeee row would be after 'I' letter. There is an issue for Turkish text.

yeotifhr

yeotifhr1#

默认情况下,Oracle使用二进制排序。这是通过对字符编码后的数值进行排序来实现的。这适用于英语字母表,因为ASCII和EBCDIC标准定义了字母A到Z的升序数值。请尝试使用'语言排序'。请参阅此处-
https://docs.oracle.com/cd/B10501_01/server.920/a96529/ch4.htm
示例-

SELECT * FROM test ORDER BY NLSSORT(name, 'NLS_SORT=german');

相关问题