INTERVAL
Interval data type and usages
Last updated
Interval data type and usages
Last updated
An
INTERVAL
object represents duration or amount of time, without referring to any specific point in time. There is no equivalent in Snowflake so it is transformed to Varchar ()
Syntax
In BigQuery the datetime_part follows the next canonical format:
As is known, Snowflake only supports Interval as a data type in arithmetic operations, which is why the CURRENT_TIMESTAMP
function is added to each operand to correctly support the comparison.
In BigQuery, when the substring corresponding to the year-month is preceded by a sign (+ -), it affects both the year and the month. In a similar way, it works for the substring corresponding to the time, in this case, the following affects the hour, minute, and second. An example of this is shown below.
Snowflake does not support the scenario where the Interval data type is queried directly, on the contrary when it is used as an operator for a given date its translation is done using an (if possible).
The Interval value is transformed to a supported Snowflake format and then inserted as text inside the column. Since Snowflake does not support Interval as a data type, it is only supported in arithmetic operations. In order to use the value, it needs to be extracted and used as an (if possible).
Snowflake Intervals have several limitations. Only arithmetic operations between DATE
or TIMESTAMP
and are supported, every other scenario is not supported. For more information please review .
: Data type converted to another data type.
: Interval Literal Not Supported In Current Scenario.