ORACLE CASE用法
来源:互联网 发布:北风网大数据百度云 编辑:程序博客网 时间:2024/05/16 14:03
先建立表
create table student(idnumber(10)primary key,namevarchar(20),agenumber(10));
插入两条测试数据
insert into student values(1,'中国',23)
insert into student values(2,'美国',23)
先用case when语句查询实现当name为中国时,id变为10,当name为美国时,id变为100:
语法一:
select age,case name when '中国' then 10 when '美国'then 100 end id from student;
语法二:
select age,case when name='中国'then 10 when name= '美国' then 1000 end id from student;
我自己试验了下,如果end语句后不跟上你要查询改变的字段如下写法:
select age,case when name='中国'then id+10when name= '美国' then id+1000 end from student;
尽管查询结果也能出来,但在pl/sql出来的结果字段名不是想象的那样
- oracle case when 用法
- Oracle case when 用法
- Oracle case when用法
- oracle case when 用法
- oracle case when 用法
- ORACLE CASE用法
- oracle case when 用法
- Oracle case when用法
- oracle case when用法
- oracle case when 用法
- Oracle Case end用法
- oracle case when 用法
- oracle case then用法
- oracle 中case用法
- Oracle case when 用法
- ORACLE中CASE的用法
- ORACLE CASE WHEN 的用法
- oracle case when的用法
- android导入项目 failed to create buildconfig class
- Documentation_power_apm-acpi
- 导Excel,具有下载页面
- 风险识别的方法
- 关于oracle中的group by、having以及order by
- ORACLE CASE用法
- 什么叫MVC模式
- C++动态链接/静态链接库编程
- spark开发环境配置
- datable合并sqldataadapter不能update的思考
- 排序算法--希尔排序
- java类反射机制
- 面试相关
- 未能解析此远程名称:’nuget.org’(The remote name could not be resolved: 'nuget.org')