SQL> declare
2 v_day NUMBER := TO_CHAR(TO_DATE('20060101','YYYYMMDD'),'D');
3 begin
4 if v_day in (1,7) or (v_day not in (1,7) and (v_day between 0 and 6 or v_day between 19 and 23))
5 then
6 DBMS_OUTPUT.put_line(v_day||': Off-peak');
7 else
8 DBMS_OUTPUT.put_line(v_day||': Peak');
9 end if;
10 end;
11 /
1: Off-peak
PL/SQL procedure successfully completed.
SQL>
|