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  
  • 相关阅读:
    python class 的属性
    程序员7年和我的7点感想――我的程序人生
    LCD 调试总结 [转]
    shell sed 替换某行内容
    msm 模拟i2c使用过程分析
    高通平台USB host协议分析 之 一
    Linux文件查找命令find,xargs详述
    (翻译)Android属性系统
    内存对齐.结构体对齐
    python class 用法
  • 原文地址:https://www.cnblogs.com/wangdonghua/p/3320886.html
Copyright © 2011-2022 走看看