add_months(CURRENT_DATE() - 1,'MONTH')
throws an error
Invalid argument types for function '>=': (ROW(TIMESTAMP_NTZ(9), VARCHAR(5)), DATE)
CodePudding user response:
In Oracle and Snowflake, the syntax is:
ADD_MONTHS( <date_or_timestamp_expr> , <num_months_expr> )
So you would want:
add_months(CURRENT_DATE, -1)
(Note: CURRENT_DATE()
can also be used in Snowflake but not in Oracle.)
CodePudding user response:
Correct syntax would be like below as per documentation:
select current_date(), add_months(current_date(), 1);