OrOp 函数返回两个日历模式的并集。
OrOp (cal_patt1 CalendarPattern,
cal_patt2 CalendarPattern)
returns CalendarPattern;
此函数返回每个时间间隔都处于启用状态且在两个日历模式的任何一个中已启用的日历模式;其余时间间隔处于禁用状态。如果两个模式的时间间隔单位大小不同,那么生成的模式将具有两个时间间隔单位中较小的一个。
作为两个其他模式使用 OR 运算符组合的结果的日历模式。
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
以下 OrOp 语句返回两个每天日历模式的并集:
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
以下 OrOp 语句返回一个每小时日历模式和一个每天日历模式的并集:
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