如题,怎么判断当前系统时间是否为一天的早上8点到下午5点这个时间范围内?

解决方案 »

  1.   

     to_char(sysdate,'hh24') between '08' and '17'
      

  2.   

    -- 不考虑周六、日及节假日的话,可以简单这样写:
    SELECT (case when to_char(sysdate,'HHMI')<'0800' OR to_char(sysdate,'HHMI')>'1700' 
                 then '非上班时间'
                 else '上班时间' end) as "现在是否为上班时间"
    FROM dual;
      

  3.   


    select case
     when to_char(sysdate, 'hh24miss') between '080000' and '165959' then
    '上班时间'
     else
    '下班时间'
     end
    from   dual;