I'm trying to convert the following code from Oracle to Snowflake:
order by nlssort(name, 'NLS_SORT=BINARY')
I know NLSSORT is not a function in Snowflake, but is there anything I can use as an alternative?
I'm trying to convert the following code from Oracle to Snowflake:
order by nlssort(name, 'NLS_SORT=BINARY')
I know NLSSORT is not a function in Snowflake, but is there anything I can use as an alternative?
Copyright © 2021 Jogjafile Inc.
It should be pretty similar already to Snowflake's default sorting - you just need to consider your database charset in Oracle (
select * from nls_database_parameters where parameter='NLS_CHARACTERSET'
) and see whether it has a different binary order than ASCII/UTF-8.Oracle's documentation:
Snowflake's documentation:
So I think you should be able to just do:
It's kind of odd that somebody would write that Oracle code to begin with, since BINARY is the default sort order (collation). But if your Oracle database is using multilingual collation (which is not common) for other queries, I don't think you're going to be able to easily emulate that in Snowflake.