zoukankan      html  css  js  c++  java
  • oracle decode case语法

    SELECT col1, col2,   
           CASE   
              WHEN col3 > 1 AND col3 <2   
                 THEN '1'   
              WHEN col3 > 2 AND col3 <3   
                 THEN '2'   
              WHEN col3 > 3 AND col3 <4   
                 THEN '3'   
              ELSE '4'   
           END mylevel   
    FROM table   
      
    select case   
           when    nsrsbh='330165737758262'   then   nsrsbh  
           when    nsrsbh='330106745808709'    then   nsrsbh   
           else     '99999'  
           end   
    from WS_TDS_SQ  
    select case    nsrsbh
           when   '330165737758262'  then  nsrsbh  
           when   '330106745808709'    then   nsrsbh   
           else    '99999'  
           end   
    from table  
      
    decode(条件,值1,返回值1,值2,返回值2,...值n,返回值n,缺省值)  
    decode(字段或字段的运算,值1,值2,值3)  
    select decode (value, <if this value>, <return this value>) FROM table  
      
    select decode(col1,'330165737758262',nsrsbh,'330106745808709',nsrsbh,0) from table 
    select decode(col1,'330165737758262','6','9') from table  
  • 相关阅读:
    关于使用AWS的centos
    MySQL高可用配置(主从复制)
    tomcat+apache+jk
    Zabbix-1.8.14 安装
    centos6.5下,使用虚拟ftp用户
    java小数位-DecimalFormat(转)
    java collection 类图
    log4j详解(转)
    java强软弱虚引用详解(转载)
    Java深入理解文章(转载)
  • 原文地址:https://www.cnblogs.com/wangdonghua/p/3320886.html
Copyright © 2011-2022 走看看