MSCEWI1015
Pivot/Unpivot multiple function not supported.
This is a deprecated version of the SnowConvert documentation, please visit the official site HERE.
Severity
Medium
Description
This section describes the different issues that could be triggered by PIVOT and UNPIVOT clauses. The not supported scenarios are presented in the following table.
PIVOT | UNPIVOT | ORACLE | TERADATA | |
MULTIPLE COLUMN | X | X | X | X |
RENAME COLUMN | X | X | X | X |
MULTIPLE FUNCTION | X | X | X | |
WITH CLAUSE | X | X | ||
XML OUTPUT FORMAT | X | X | ||
IN CLAUSE SUBQUERY | X | X | X | |
IN CLAUSE ANY SEQUENCE | X | X | ||
INCLUDE/EXCLUDE NULLS | X | X | X |
MULTIPLE COLUMN
Multiple column is not supported by PIVOT and UNPIVOT clauses.
Example Code
Input Code:
Output Code:
RENAME COLUMN
Renaming columns with aliases is not supported in snowflake UNPIVOT clauses, Snow Convert is going to remove aliases for functions or columns in order to create a valid query, check that this change does not affect the original functionality.
For PIVOT, the use of column aliases is only supported in SnowConvert for Teradata if the following two conditions are true: all expressions inside the IN clause have an alias associated and Snowconvert has information about the columns that will be generated as result, either by providing the table definition or using a subquery with an explicit column list as input to the clause.
Example Code
Input Code:
Output Code:
MULTIPLE FUNCTION
Multiple function is not supported for PIVOT clauses, sometimes multiple function queries could be re-written using case statements, see the following Teradata sample for more information https://docs.teradata.com/r/756LNiPSFdY~4JcCCcR5Cw/L0kKSOrOeu_68mcW3o8ilw
Example Code
Input Code:
Output Code:
WITH CLAUSE
Teradata PIVOT has an optional WITH clause, this is not allowed in snowflake's PIVOT.
Example Code
Input Code:
Output Code:
XML OUTPUT FORMAT
XML output for PIVOT clause is not supported by snowflake.
Example Code
Input Code:
Output Code:
IN CLAUSE SUBQUERY
Subqueries for IN clause are not supported.
Example Code
Input Code:
Output Code:
IN CLAUSE ANY SEQUENCE
This error is triggered when ANY keyword is used in IN clause. This is currently not supported.
Example Code
Input Code:
Output Code:
INCLUDE/EXCLUDE NULLS
INCLUDE NULLS or EXCLUDE NULLS are not valid options for UNPIVOT clauses in snowflake.
Example Code
Input Code:
Output Code:
Recommendations
Re-write the query if possible, otherwise, no additional user actions are required.
If you need more support, you can email us at snowconvert-support@snowflake.com
Last updated