You're welcome!类似的还有一个NVL(field_name,other_value)
if value of field_name is null then
return value
else
return value of field_name
end if;
if value of field_name is null then
return value
else
return value of field_name
end if;
解决方案 »
- unidac连接到oracle问题
- ORA-00979 与 ORA-02063 错误原因?
- 通过ORACLE 访问(读写) SQL SERVER (求购)
- 怎麼找出兩個數據庫的結構差異
- sybase的存储过程转换到oracle上的问题
- 包怎么保存?
- 求救,存储过程中调用SYS.Dba_Tab_Columns提示:......
- 怎样用动态语句在9i中实现对表的判断
- 我的一个job怎么不会执行?
- 请问在ORACLE 8 OCI接口中怎样实现限制每次查询的记录数(有类似于SQL SERVER 中的SET ROWCOUNT函数吗?)
- oracle中如何实现这句的功能(sql server下能通过)
- 可以把sql文的结果输出到制定的文件吗?
return other_value
else
return value of field_name
end if;
E:\oracle\ora92\database>sqlplus /nologSQL*Plus: Release 9.2.0.1.0 - Production on 星期五 1月 25 11:22:16 2002Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.SQL> conn lunar/lunar
已连接。
SQL> create table testcase
2 (a char(6),
3 b number(10),
4 c char(9),
5 d number(10,2),
6 e char(20));表已创建。SQL> insert into testcase values('aa',110,'你好',100.2,'abc');已创建 1 行。SQL> insert into testcase values('bb',200,'大家好',120.25,'abcde');已创建 1 行。SQL> insert into testcase values('cc',150,'和平',50.9,'xyz');已创建 1 行。SQL> insert into testcase values('dd',170,'和平',200,'rst');已创建 1 行。SQL> insert into testcase values('ee',10,'公安部',21,'morning');已创建 1 行。SQL> commit;提交完成。SQL> select * from testcase;A B C D E
------ ---------- --------- ---------- --------------------
aa 110 你好 100.2 abc
bb 200 大家好 120.25 abcde
cc 150 和平 50.9 xyz
dd 170 和平 200 rst
ee 10 公安部 21 morningSQL> select a,b,(case when b>150 then '大于150'
2 when b=150 then '等于150'
3 when b<150 then '小于150'
4 else '输入错误'
5 end) as c, d,e
6 from testcase
7 /A B C D E
------ ---------- -------- ---------- --------------------
aa 110 小于150 100.2 abc
bb 200 大于150 120.25 abcde
cc 150 等于150 50.9 xyz
dd 170 大于150 200 rst
ee 10 小于150 21 morningSQL>