数据库
首页 > 数据库> > oracle某些sql计算

oracle某些sql计算

作者:互联网

1.计算当前时间最近的15分整点数据

    select rdc.city_code          as city_id,
           rdc.city_name,
           rdc.DIS_FAIL_ORDER_NUM as RES_PREE_FAILURE_NUM,
           --以下是计算最近的整分时间
           to_char(sysdate, 'hh24') || ':' ||
           CASE trunc(to_char(sysdate, 'mi') / 15, 0)
             WHEN 0 THEN
              '00'
             WHEN 1 THEN
              '15'
             WHEN 2 THEN
              '30'
             WHEN 3 THEN
              '45'
             ELSE
              '00'
           END as HOUR_MIN
      from res_dis_city rdc
     where rdc.create_date =
           (select max(t.create_date) from res_dis_city t);

 

标签:city,15,某些,WHEN,char,rdc,sql,oracle,select
来源: https://www.cnblogs.com/linhongwenBlog/p/10783852.html