Datetime Arithmetic
This content explains the current transformation for some arithmetic operations between datetime types.
Description
In Oracle, some arithmetic operations could be performed between DateTime types, like addition, subtraction, multiplication, and division. Currently, SnowConvert can resolve some cases of addition and subtraction. These cases are explained below.
Sample Source Patterns
This is a summary of the current transformation for the different combinations of the addition and subtraction operations with date, timestamps, number, and unknown types.
Consider the next table for the examples below.
Addition
Combination Matrix
This is a summary of how the migrator resolves the addition operations for the different combinations with date, timestamps, number, and unknown types.
An Unknown Type column is the result of the migrator being unable to establish the data type that the column contains. This can happen for many reasons, for example missing DDLs for the tables being operated on, columns resulting from operations on views, CTES or subqueries, etc.
The different paths that the migrator can use for resolving the add operations will be explained below:
Invalid
Certain combinations are not valid to perform addition operations in Oracle:
Oracle
Date + Interval day
This is the current transformation for the addition operation between a date type and a number (and vice versa). For example
Oracle
Snowflake
Timestamp + Interval day
This is the current transformation for the addition operation between a timestamp type and a number (and vice versa). For example
Oracle
Note: In Oracle, both DATE and TIMESTAMP columns contain a time component, but Oracle has used the format mask specified by the NLS_DATE_FORMAT parameter to decide how to implicitly convert the date to a string, that is why when performing some operations between TIMESTAMP and Intervals, he result could be shown as DATE, hiding the time component, unless the NLS_DATE_FORMAT parameter is changed.