SnowConvert AI - Oracle - Select¶
In this section you could find information about the select query syntax and its conversions.
Note
Some parts in the output codes are omitted for clarity reasons.
Overall Select Translation¶
Simple select¶
Oracle:¶
Snowflake:¶
Where clause¶
Oracle:¶
Snowflake:¶
Order By clause¶
Oracle:¶
Snowflake:¶
Group by¶
Oracle:¶
Snowflake:¶
Model Clause¶
The model clause is not supported yet.
Row Limiting Clause¶
Oracle:¶
Snowflake:¶
Note
In Oracle, the FETCH / OFFSET WITH TIES is ignored when no ORDER BY is specified in the SELECT. This case will be transformed to a FETCH / OFFSET with the ONLY keyword in Snowflake, please note that in Snowflake the ONLY keyword has no effect in the results and is used just for readability.
Pivot¶
Snowflake does not support the following statements:
- Rename columns
- Multiple Columns
Oracle:¶
Snowflake:¶
Unpivot¶
Snowflake does not support the following statements:
- INCLUDE / EXCLUDE NULLS
Oracle:¶
Snowflake:¶
Transformation of JOIN (+) to ANSI Syntax¶
Danger
This translation is currently deactivated and it’s only meant for reference for translations done with previous versions of SnowConvert AI. For the current translation check the section above.
SnowConvert AI translates the NON-ANSI special outer join (+) syntax to ANSI outer join syntax. This subsection shows some examples:
To LEFT OUTER JOIN¶
Example 1:
Oracle:¶
Snowflake:¶
Example 2:
Oracle:¶
Snowflake:¶
Example 3: Multiple join
Oracle:¶
Snowflake:¶
Example 4: Join with other kinds of conditional
Oracle:¶
Snowflake:¶
Example 5: Join with (+) inside a function
Oracle:¶
Snowflake:¶
Warning
Please be aware that some of the patterns that were translated to LEFT OUTER JOIN could retrieve the rows in a different order.
To CROSS JOIN¶
Example 6: Complex case that requires the use of CROSS JOIN
Oracle:¶
Snowflake:¶
Hierarchical Queries¶
Hierarchical queries in Snowflake allow you to organize and retrieve data in a tree-like structure, typically using the CONNECT BY clause. This clause joins a table to itself to process hierarchical data in the table.
Sample Source Patterns¶
Oracle:¶
Snowflake:¶
Select Flashback Query¶
Description¶
Oracle
The flashback query claused in Oracle retrieves past data from a table, view, or materialized view. In Oracle, the uses can include:
Restoring deleted data or undoing an incorrect commit, comparing current data with the corresponding data at an earlier time, checking the state of transactional data at a particular time, and reporting generation tools to past data, among others. (Oracle Flashback query documentation).
Snowflake
The equivalent mechanism in Snowflake to query data from the past is the AT | BEGIN query. Notice that the only equivalent is for the AS OF statements.
Furthermore, Snowflake has complete “Time Travel” documentation that allows querying data to clone objects such as tables, views, and schemas. There are limitations on the days to access the past or deleted data (90 days before passing to Fail-safe status). For more information, review the Snowflake Time Travel Documentation.
Oracle syntax
Snowflake Syntax
Note
Notice that the query ID must reference a query executed within 14 days. If the query ID references a query over 14 days old, the following error is returned: Error: statement <query_id> not found. To work around this limitation, use the time stamp for the referenced query. (Snowflake AT | Before documentation)
Sample Source Patterns¶
The following data is used in the following examples to generate the query outputs.
Oracle¶
Snowflake¶
1. AS OF with TIMESTAMP case¶
Oracle¶
Snowflake¶
2. AS OF with SCN case¶
Oracle¶
Snowflake¶
Known Issues¶
The option when it is using SCN is not supported.
The VERSION statement is not supported in Snowflake.
Related EWIs¶
SSC-EWI-0040: Statement Not Supported.
SSC-EWI-OR0135: Current of clause is not supported in Snowflake.
SSC-FDM-0006: Number type column may not behave similarly in Snowflake.
SSC-FDM-OR0042: Date Type Transformed To Timestamp Has A Different Behavior.