Oracle decode函数
来源:互联网 发布:2007excel无法粘贴数据 编辑:程序博客网 时间:2024/06/01 07:21
1.低于2000的乘1.2,高于2000的乘1.15
1.1 select t.quantity,decode(sign(quantity - 2000),1,quantity*1.15,-1,quantity*1.2) from table t;
结果如:
1000 1150
2000 2000--------------------------------------这里因为少了0的判断
3000 3600
1.2 select score,decode(sign(score - 80),1,'良',0,'良',-1,'非良') from student t;
2.字段名为lock_date的字段做匹配,如果里面的值是null(空)则显示为 unlocked 否则就显示为locked.
2.1 select username,decode(lock_date,null,'unlocked','locked') status from t;
多个嵌套
select id, decode(sign(score-85),1,'优秀',0,'优秀',-1,
decode(sign(score-70),1,'良好',0,'良好',-1,
decode(sign(score-60),1,'及格',0,'及格',-1,'不及格')))
from student;
0 0
- oracle decode.oracle 函数用法之decode
- Oracle中Decode()函数
- ORACLE 中的DECODE函数
- oracle中decode函数
- Oracle DECODE函数
- Oracle的DECODE函数
- Oracle decode函数
- Oracle函数Decode
- oracle decode()函数
- oracle-decode函数
- oracle decode函数
- oracle DECODE函数
- oracle中的decode函数
- ORACLE DECODE函数
- oracle函数decode
- decode()函数是ORACLE
- Oracle Decode函数详解
- Oracle-DECODE函数用法
- CSS 教程 从 HTML + CSS开始
- Java基础02 方法与数据成员
- 为什么我的findviewbyid 找不到布局中的控件
- Hadoop快速入门
- 获取Tap手势坐标和CGRect包含交错,边缘,中心的检测
- Oracle decode函数
- Java数据结构(Data Structures)
- Photoshop脚本 > 通过拷贝创建一个图层
- vim taglist配置
- float && double
- Cocos2dx学习笔记34 使用tolua++编译pkg,从而创建自定义类让Lua脚本使用
- 全文索引权限的问题
- 编码规范
- iOS 开发:绘制像素到屏幕