Interval Literals
Description
Interval literals can be used in datetime calculations, such as, adding intervals to dates and timestamps, summing intervals, and subtracting an interval from a date or timestamp. Interval literals can be used as input values to interval data type columns in a table.. (Redshift SQL Language reference Interval Literals).
This grammar is partially supported in Snowflake.
Grammar Syntax
INTERVAL quoted-string [ year_to_month_qualifier ]
INTERVAL quoted-string [ day_to_second_qualifier ] [ (fractional_precision) ]Snowflake Intervals can only be used in arithmetic operations. Intervals used in any other scenario are not supported.
The following formats are the only ones recognized and fully transformed by SnowConvert, allowing optional fields and most of the abbreviations without interval styles:
1. 1 year 1 month 1 day 2 hour 3 minutes 4 seconds 123 ms
2. hh:mm:ss.ms
3. 1 year 1 month 1 day hh:mm:ss.msSnowflake does not support literals with arithmetic signs. If the Literal contains an hour expression the expression can be partially transformed.
Sample Source Patterns
Supported scenarios
Input Code:
Output Code:
Pending translation scenarios
Input Code:
Output Code:
Know Issues
No issues were found.
Related EWIs
SSC-EWI-0107: Interval Literal Not Supported In Current Scenario.
SSC-EWI-0073: Pending Functional Equivalence Review.
Last updated
