SELECT CASE WHEN c_sex ='1' THEN '女' ELSE '男' END 
FROM student WHERE id<100

解决方案 »

  1.   

    基本语法
    CASE expression syntax is similar to an IF-THEN-ELSE statement. Oracle checks each condition starting from the first condition (left to right). When a particular condition is satisfied (WHEN part) the expression returns the tagged value (THEN part). If none of the conditions are matched, the value mentioned in the ELSE part is returned. The ELSE part of the expression is not mandatory-- CASE expression will return null if nothing is satisfied.case when <condition> then <value>
    when <condition> then <value>
    ...
    else <value>
    end 示例
    The following examples will make the use of CASE expression more clear.E.g.: Returning categories based on the salary of the employee.select sal, case when sal < 2000 then 'category 1' 
                     when sal < 3000 then 'category 2' 
                     when sal < 4000 then 'category 3' 
                     else 'category 4' 
                end 
    from emp; 
      

  2.   

    在8.*版本中,没有CASE WHEN 
    怎么实现同上的功能???
      

  3.   

    我的816都可以支持了,如果以下版本你可以使用DECODE