PERIOD_CONTAINS
functionsupportedCore SQL functionsReturns TRUE if a PERIOD contains another PERIOD, or contains a temporal instant of the same element type.
Syntax
PERIOD_CONTAINS has two overloads: one that tests whether a PERIOD contains another PERIOD, and one that tests whether a PERIOD contains a single temporal instant.
PERIOD_CONTAINS( <period1>, <period2> )
PERIOD_CONTAINS has two overloads: one that tests whether a PERIOD contains another PERIOD, and one that tests whether a PERIOD contains a single temporal instant.
PERIOD_CONTAINS( <period>, <value> )
Parameters
| Name | Required | Description |
|---|---|---|
period1 | required | The outer PERIOD value. |
period2 | required | The inner PERIOD value. Must have the same element type as period1. |
period | required | The PERIOD value to test. |
value | required | A DATE, TIME, or TIMESTAMP value whose logical type matches the PERIOD element type. |
Returns
BOOLEAN.
Usage notes
- PERIOD overload: TRUE when PERIOD_BEGIN(period1) <= PERIOD_BEGIN(period2) and PERIOD_END(period2) <= PERIOD_END(period1).
- Scalar overload: TRUE when PERIOD_BEGIN(period) <= value < PERIOD_END(period) (inclusive beginning bound, exclusive ending bound).
- The exclusive ending bound is not contained. For example, PERIOD_CONTAINS(PERIOD(DATE) '[2024-01-01, 2024-04-01)', DATE '2024-04-01') is FALSE.