oracle条件查询:case和decode使用实例
[code]
分别用case和decode函数列出员工所在的部门,deptno=10显示'部门10',
deptno=20显示'部门20'
deptno=30显示'部门30'
deptno=40显示'部门40'
否则为'其他部门'
select ename, case deptno
when 10 then '部门10'
when 20 then '部门20'
when 30 then '部门30'
when 40 then '部门40'
else '其他部门'
end 工资情况
from scott.emp
select ename,decode(deptno,10,'部门10',20,'部门20',30,'部门30',40,'部门40','其他部门') 工资情况 from scott.emp
[/code]
oracle条件查询:case和decode使用实例
原创mb644638dfa963e 博主文章分类:oracle ©著作权
文章标签 Oracle 条件查询 oracle 文章分类 JavaScript 前端开发
下一篇:ant执行sql文件源码
-
oracle中decode和case的使用例子
decode是很不错的条件函数,但是它却不能使用范围来进行条件区分,而case则刚好弥补了这一缺点,以下是二者的例子比较
oracle case 休闲 例子 decode -
如何正确使用case when表达式 和 decode函数?
case when、decode的区别
case when、decode的区别