Lưu ý
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử đăng nhập hoặc thay đổi thư mục.
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử thay đổi thư mục.
Applies to:
Databricks SQL
Databricks Runtime 10.4 LTS and above
Creates an year-month interval from years and months.
Syntax
make_ym_interval( [ years [, months ] ] )
Arguments
years: An integral number of years, positive or negativemonths: An integral number of months, positive or negative
Returns
An INTERVAL YEAR TO MONTH.
Unspecified arguments are defaulted to 0.
If you provide no arguments the result is an INTERVAL '0-0' YEAR TO MONTH.
The function is equivalent to executing:
INTERVAL year YEARS + INTERVAL month MONTHS.
As such each unit can be outside of its natural range as well as negative.
If the result overflows, Azure Databricks raises INTERVAL_ARITHMETIC_OVERFLOW.
Common error conditions
Examples
> SELECT make_ym_interval(100, 5);
100-5
> SELECT make_ym_interval(100, null);
NULL
> SELECT make_ym_interval(0, 13);
1-1
> SELECT make_ym_interval(1, -1);
0-11
> SELECT make_ym_interval(178956970, 8);
Error: INTERVAL_ARITHMETIC_OVERFLOW