OrOp function
The OrOp function returns the union of the two calendar patterns.
Syntax
OrOp (cal_patt1 CalendarPattern,
cal_patt2 CalendarPattern)
returns CalendarPattern;
- cal_patt1
- The first calendar pattern.
- cal_patt2
- The second calendar pattern.
Description
The OrOp function returns a calendar pattern that has every interval on that was on in either of the calendar patterns; the rest of the intervals are off. If the two patterns have different sizes of interval units, the resultant pattern has the smaller of the two intervals.
Returns
A calendar pattern that is the result of two others that are combined with the OR operator.
Example
The examples
use the following three calendar pattern definitions:
select * from CalendarPatterns
where cp_name = 'workweek_day';
cp_name workweek_day
cp_pattern {1 off,5 on,1 off},day
select * from CalendarPatterns
where cp_name = 'fourday_day';
cp_name fourday_day
cp_pattern {1 off,4 on,2 off},day
select * from CalendarPatterns
where cp_name = 'workweek_hour';
cp_name workweek_hour
cp_pattern {32 off,9 on,15 off,9 on,15 off,9 on,15 off,
9 on,15 off,9 on,31 off},hour
The following OrOp statement returns the union of two daily calendar patterns:
select OrOp(p1.cp_pattern, p2.cp_pattern)
from CalendarPatterns p1, CalendarPatterns p2
where p1.cp_name = 'workweek_day'
and p2.cp_name = 'fourday_day';
(expression) {1 off,5 on,1 off},day
The following OrOp statement returns the union of one hourly and one daily calendar pattern:
select OrOp(p1.cp_pattern, p2.cp_pattern)
from CalendarPatterns p1, CalendarPatterns p2
where p1.cp_name = 'workweek_day'
and p2.cp_name = 'workweek_hour';
(expression) {24 off,120 on,24 off},hour