TERA Mode For Strings Comparison - COLLATE
This section defines the translation specification for string in Tera mode with the use of COLLATE.
Description
Tera Mode for string comparison and COLLATE usage
The Tera Mode string comparison will apply the COLLATE constraint to the columns or statements as required. The default case specification trim behavior may be taken into account. The default case specification in Teradata for TERA mode is NOT CASESPECIFIC
. Thus, the columns without case specification will have COLLATE('en-ci')
constraints.
Sample Source Patterns
Setup data
Comparison operation
Case 1: Column constraint is NOT CASESPECIFIC and database mode is TERA Mode
Teradata
Snowflake
Case 2: Column constraint is CASESPECIFIC and database mode is TERA Mode
Teradata
Snowflake
Case 3: CAST NOT CASESPECIFIC column to CASESPECIFIC and database mode is TERA Mode
Notice that the following queries
SELECT * FROM employees WHERE first_name = 'JOHN ' (CASESPECIFIC)
SELECT * FROM employees WHERE first_name (CASESPECIFIC) = 'JOHN '
will return the same values.
Teradata
Snowflake
Case 4: CAST CASESPECIFIC column to NOT CASESPECIFIC and database mode is TERA Mode
CAST to a column on the left side of the comparison has priority.
For example:
SELECT * FROM employees WHERE last_name (NOT CASESPECIFIC) = 'snoW';
will return 5 rows.SELECT * FROM employees WHERE last_name = 'snoW' (NOT CASESPECIFIC);
will return 0 rows with this setup data.
Teradata
Snowflake
LIKE operation
Case 1: Column constraint is NOT CASESPECIFIC and database mode is TERA Mode
Teradata
Snowflake
Case 2: Column constraint is CASESPECIFIC and database mode is TERA Mode
Teradata
Snowflake
Case 3: CAST NOT CASESPECIFIC column to CASESPECIFIC and database mode is TERA Mode
Teradata
Snowflake
Case 4: CAST CASESPECIFIC column to NOT CASESPECIFIC and database mode is TERA Mode
Teradata
Snowflake
IN Operation
Case 1: Column constraint is NOT CASESPECIFIC and database mode is TERA Mode
Teradata
Snowflake
Case 2: Column constraint is not defined and database mode is TERA Mode
In Tera mode, not defined case specification means NOT CASESPECIFIC
.
Teradata
Snowflake
Case 3: Column constraint is CASESPECIFIC and database mode is TERA Mode
Teradata
Snowflake
ORDER BY clause
Case 1: Column constraint is NOT CASESPECIFIC and database mode is TERA Mode
Teradata
Snowflake
Case 2: Column constraint is CASESPECIFIC and database mode is TERA Mode
Teradata
Snowflake
GROUP BY clause
Case 1: Column constraint is NOT CASESPECIFIC and database mode is TERA Mode
Teradata
Snowflake
Case specification in output may vary depending on the number of columns selected.
Case 2: Column constraint is CASESPECIFIC and database mode is TERA Mode
Teradata
Snowflake
HAVING clause
The HAVING clause will use the patterns in:
Evaluation operations.
For example:
=, !=, <, >.
LIKE operation.
IN Operation.
CAST to evaluation operation.
CAST to LIKE operation.
The following sample showcases a pattern with evaluation operation.
Sample: Column constraint is NOT CASESPECIFIC and database mode is TERA Mode
Teradata
Case specification in output may vary depending on the number of columns selected. This is also related to the GROUP BY
clause.
Snowflake
CASE WHEN statement
The CASE WHEN
statement will use the patterns described in:
Evaluation operations.
For example:
=, !=, <, >.
LIKE operation.
IN Operation.
CAST to evaluation operation.
CAST to LIKE operation.
The following sample showcases a pattern with evaluation operation.
Teradata
Snowflake
JOIN clause
Simple scenarios with evaluation operations are supported.
The JOIN
statement will use the patterns described in:
EvaluaComparisonComparisontion operations.
For example:
=, !=, <, >.
LIKE operation.
IN Operation.
CAST to evaluation operation.
CAST to LIKE operation.
The following sample showcases a pattern with evaluation operation.
Sample: Column constraint is NOT CASESPECIFIC and database mode is TERA Mode
Teradata
Snowflake
Related EWIs
SSC-EWI-TD0007: GROUP BY REQUIRED COLLATE FOR CASE INSENSITIVE COLUMNS
SC-FDM-TD0032 : [NOT] CASESPECIFIC CLAUSE WAS REMOVED
Last updated