平常不怎么接触sql,关于case when一直很模糊,想问下,如果我有这么个情况,就是说,如果a=2或者b=3的情况下 c=4,如果a=5的情况下,c=5,请问用case when 怎么写呢?求教
解决方案 »
- 问个oracle很白痴的问题
- 求unixODBC-devel-2.2.14-9.el6.x86_64.rpm
- Oracle数据导入SQLSERVER报错
- 求一SQL语句
- ORACLE客户端连接远程主机的问题
- win2003下安装oracle9i问题!急呀!!!
- 请问谁有10g的init*.ora文件?我的老是报错,不知道是什么原因。我的系统是rhas3
- 请问,我使用imp倒入dmp(792M)文件的时候,一个大表(600W行数据)显示倒完之后就死哪不动了,怎么办?
- HTMLDB求救!!!!!!!!!
- 数据库报错,各位达人帮忙看看是什么错误引起的!
- oralce for 循环变量 类型
- 查看oracle日志
a number := 2;
b number := 3;
c number;
begin
select (case when a=2 or b = 3 then 4 when a = 5 then 5 end) into c from dual;
dbms_output.put_line(c);
end;
case when 条件1 then 语句1或表达式1
when 条件2 then 语句2或表达式2
......
else 语句n或表达式n
end
when a=5 then c=5 end
a int :=2;
b int :=4;
c int ;
begin
c :=case when a=2 or b=3 then 4 when a=5 then 5 end ;
dbms_output.put_line('c的值:'||c);
end;
a=1则取2否则取3
case a when 1 then 2 else 3 end
case when a=1 then 2 else 3 end
case when (a=2 or b=3) then c=4
when a=5 then c=5
else c=10 end