NLSSORT 甲骨文到雪花
NLSSORT Oracle to Snowflake
我正在尝试将以下代码从 Oracle 转换为 Snowflake:
order by nlssort(name, 'NLS_SORT=BINARY')
我知道 NLSSORT 不是 Snowflake 中的函数,但有什么我可以替代的吗?
它应该已经与 Snowflake 的默认排序非常相似 - 您只需要考虑 Oracle 中的数据库字符集 (select * from nls_database_parameters where parameter='NLS_CHARACTERSET'
) 并查看它是否具有与 ASCII/UTF-8 不同的二进制顺序。
If the value is BINARY, then comparison is based directly on byte
values in the binary encoding of the character values being compared.
All data is sorted according to the numeric byte value of each
character in the ASCII table. UTF-8 encoding is supported.
所以我认为你应该能够做到:
order by name
有些人会以 Oracle 代码开头,这有点奇怪,因为 BINARY 是默认的排序顺序(归类)。但是,如果您的 Oracle 数据库对于其他查询是 using multilingual collation(这并不常见),我认为您将无法在 Snowflake 中轻松地模拟它。
我正在尝试将以下代码从 Oracle 转换为 Snowflake:
order by nlssort(name, 'NLS_SORT=BINARY')
我知道 NLSSORT 不是 Snowflake 中的函数,但有什么我可以替代的吗?
它应该已经与 Snowflake 的默认排序非常相似 - 您只需要考虑 Oracle 中的数据库字符集 (select * from nls_database_parameters where parameter='NLS_CHARACTERSET'
) 并查看它是否具有与 ASCII/UTF-8 不同的二进制顺序。
If the value is BINARY, then comparison is based directly on byte values in the binary encoding of the character values being compared.
All data is sorted according to the numeric byte value of each character in the ASCII table. UTF-8 encoding is supported.
所以我认为你应该能够做到:
order by name
有些人会以 Oracle 代码开头,这有点奇怪,因为 BINARY 是默认的排序顺序(归类)。但是,如果您的 Oracle 数据库对于其他查询是 using multilingual collation(这并不常见),我认为您将无法在 Snowflake 中轻松地模拟它。