SELECT CASE WHEN c_sex ='1' THEN '女' ELSE '男' END
FROM student WHERE id<100
FROM student WHERE id<100
解决方案 »
- 关于oracle查询结果日期的优化,在线等,急!!!
- 求一条SQL语句?查询当天、一周或一个月内的数据?
- oracle forms builder 编写一个pll库文件,请问可以调用早已经编译好的另一个pll库文件里的函数在新的一个pll库文件中吗?
- 问一下下面这两种Oracle分页哪种写法是对的
- 请教存储过程里,对象的名称是参数则么写法。
- oracle不认javax.crypto.*;这个类包怎么办?
- 急急!! 插入数据的问题???——————在线等待
- oracle的查询问题!
- SQL文里的:符号跟#符号是什么意思?多谢!
- 请问下面的存储过程错在那里?
- oracle9中不能显示新建数据库
- 请问在sqlplus建的表在oracle enterprise manager console中可不可以看得见?
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;
怎么实现同上的功能???