SnowConvert AI - Oracle - Literals¶
The terms literal and constant value are synonymous and refer to a fixed data value.
(Oracle SQL Language Reference Literals (https://docs.oracle.com/en/database/oracle/oracle-database/21/sqlrf/Literals.html#GUID-192417E8-A79D-4A1D-9879-68272D925707))
Interval Literal¶
Interval Literal Not Supported In Current Scenario
Description¶
Snowflake Intervals can only be used in arithmetic operations. Intervals used in any other scenario are not supported.
Example Code¶
Oracle¶
Snowflake¶
Known Issues¶
No issues were found.
Interval Type and Date Type¶
Operation Between Interval Type and Date Type not Supported
Description¶
INTERVAL YEAR TO MONTH and INTERVAL DAY TO SECOND are not a supported data type, they are transformed to VARCHAR(20). Therefore all arithmetic operations between Date Types and the original Interval Type Columns are not supported.
Furthermore, operations between an Interval Type and Date Type (in this order) are not supported in Snowflake; and these operations use this EWI as well.
Example Code¶
Oracle¶
Snowflake¶
Recommendations¶
Implement the UDF to simulate the Oracle behavior.
Extract the already transformed value that was stored in the column during migration, and use it as a Snowflake Interval Constant when possible.
If you need more support, you can email us at snowconvert-support@snowflake.com
Related EWIs¶
SSC-EWI-0036: Data type converted to another data type.
SSC-EWI-OR0095: Operation Between Interval Type and Date Type not Supported.
SSC-FDM-OR0042: Date Type Transformed To Timestamp Has A Different Behavior.
Text literals¶
Description¶
Use the text literal notation to specify values whenever
stringappears in the syntax of expressions, conditions, SQL functions, and SQL statements in other parts of this reference.(Oracle SQL Language Reference Text literals (https://docs.oracle.com/en/database/oracle/oracle-database/21/sqlrf/Literals.html#GUID-1824CBAA-6E16-4921-B2A6-112FB02248DA))
Sample Source Patterns¶
Empty string (‘’)¶
The empty strings are equivalent to NULL in Oracle, so in order to emulate the behavior in Snowflake, the empty strings are converted to NULL or undefined depending if the literal is used inside a procedure or not.
Oracle¶
Result¶
UPPER(‘’) |
|---|
Snowflake¶
Result¶
UPPER(NULL) |
|---|
Empty string in stored procedures¶
Oracle¶
Result¶
COL1 |
COL2 |
|---|---|
hello |
Snowflake¶
Result¶
COL1 |
COL2 |
|---|---|
hello |
Empty string in built-in functions¶
Warning
The transformation does not apply when the empty string is used as an argument of the REPLACE and CONCAT functions in order to keep the functional equivalence.
Oracle¶
Result¶
REPLACE(‘HELLOWORLD’,’’,’L’) |
CONCAT(‘A’,’’) |
|---|---|
Hello world |
A |
Snowflake¶
Result¶
REPLACE(‘HELLO WORLD’, ‘’, ‘L’) |
CONCAT(‘A’,’’) |
|---|---|
Hello world |
A |
Note
If the empty strings are replaced by NULL for these cases, the results of the queries will be different.
Known Issues¶
No issues were found.
Related EWIs¶
No related EWIs.