oracle数据库,对每个月份进行分类获取对应月份的对应内容,case...when... 的使用

 select (CASE WHEN to_char(sysdate, 'MM' )='01' then 'A'
              WHEN to_char(sysdate, 'MM' )='02' then 'B'
              WHEN to_char(sysdate, 'MM' )='03' then 'C'
              WHEN to_char(sysdate, 'MM' )='04' then 'D'
              WHEN to_char(sysdate, 'MM' )='05' then 'E'
              WHEN to_char(sysdate, 'MM' )='06' then 'F'
              WHEN to_char(sysdate, 'MM' )='07' then 'G'
              WHEN to_char(sysdate, 'MM' )='08' then 'H'
              WHEN to_char(sysdate, 'MM' )='09' then 'I'
              WHEN to_char(sysdate, 'MM' )='10' then 'J'
              WHEN to_char(sysdate, 'MM' )='11' then 'K'
              WHEN to_char(sysdate, 'MM' )='12' then 'L' end) || lpad(SEQ_NXHTBH.nextval, 4, '0') START_CODE from dual 

 

posted on 2018-07-30 09:29  EastChilde  阅读(549)  评论(0编辑  收藏  举报

导航