The Period functions are only available when connected to a Teradata database. Double-click on Period to see the following functions (a subset of the total functions available).
Variable Creation > Input > Variables: SQL Elements pane - Logical > Period Functions
There are a number of functions and predicate operators connected with the family of period data types. The predicate operators return a True/False result and may be used in expert clauses such as the WHERE clause, or in WHEN conditions in CASE statements. Many of the functions and operators involve both period and Date/Time expressions or intervals, while two, Next and Prior, involve only Date/Time expressions. For more detailed descriptions of these functions and operators, refer to SQL Functions, Operators, Expressions, and Predicates, B035-1145.
Function/Predicate | Description | Parameters | Result |
---|---|---|---|
Begin | Beginning value of period | Period Expression | Date/Time |
Contains | First contains second | 2- Date/Time or Period | True/False |
End | Ending value of period | Period Expression | Date/Time |
Equals | True if begin and end for each matches the other | Period Expression | True/False |
Immediately Precedes | True if end of period 1 equals begin of period 2 | Period Expression | True/False |
Immediately Succeeds | True if begin of period 1 equals end of period 2 | Period Expression | True/False |
Interval | Length of time in period expressed as interval type | Period Expression | Date/Time Interval |
Is Until Changed | Tests end of period | Period Expression | True/False |
Is Not Until Changed | Tests end of period | Period Expression | True/False |
Is Until Closed | Tests end of period | Period Expression | True/False |
Is Not Until Closed | Tests end of period | Period Expression | True/False |
Last | Period end minus granule | Period Expression | |
Meets | Adjacent time periods | 2- Date/Time or Period | True/False |
Next | Next value by a granule | Date/Time Expression | Date/Time |
Not Contains | First not contains second | 2- Date/Time or Period | True/False |
Not Meets | Non-adjacent periods | 2- Date/Time or Period | True/False |
Not Precedes | First not before second | 2- Date/Time or Period | True/False |
Not Succeeds | First not after second | 2- Date/Time or Period | True/False |
Overlaps | First pair overlaps second | 2- Date/Time Pair, Subquery or Period | True/False |
P_Intersect | Period that two periods have in common | 2-Period Expression | Period |
P_Normalize | Combination of periods that meet or overlap | 2-Period Expression | Period |
Precedes | First value before second | 2- Date/Time or Period | True/False |
Prior | Previous value by one granule | Date/Time Expression | Date/Time |
LDiff | Portion of left overlapping period not in second | 2-Period Expression | Period |
RDiff | Portion right overlapping period not in second | 2-Period Expression | Period |
Succeeds | First value after second | 2- Date/Time or Period | True/False |