oracle中游标的where条件中可以有case when 语句吗,具体写法是什么?
例如:
cursor cur_dalei(dalei in varchar2) is
select a.id,v.catalog
from bom a,cux b
where a.id=b.id
and (case when dalei is null then null end
case when dalei='设备' then v.catalog not like '%材料%' and v.catalog not like '%建筑%' end
case when dalei='材料' then v.catalog not like '%设备%' and v.catalog not like '%建筑%' end
case when dalei='建筑' then v.catalog not like '%设备%' and v.catalog not like '%材料%' end)
order by a.id;
这样执行不下去,语法有错误吗?还是cursor根本就不支持where条件后加case when语句?
急啊,麻烦各位了!
cursor cur_dalei(dalei in varchar2) is
select a.id,v.catalog
from bom a,cux b
where a.id=b.id
and (case when dalei is null then null end
case when dalei='设备' then v.catalog not like '%材料%' and v.catalog not like '%建筑%' end
case when dalei='材料' then v.catalog not like '%设备%' and v.catalog not like '%建筑%' end
case when dalei='建筑' then v.catalog not like '%设备%' and v.catalog not like '%材料%' end)
order by a.id;
这样执行不下去,语法有错误吗?还是cursor根本就不支持where条件后加case when语句?
急啊,麻烦各位了!
...全文
相关推荐
Oracle sql文总结(case when,查看执行计画,文本操作,查看锁表及解锁,游标)
Oracle sql文总结(case when,查看执行计画,文本操作,查看锁表及解锁,游标)
oracle中游标的使用
oracle游标的使用的代码和详解过程的描述
Oracle中的SUM用法讲解
今天小编就为大家分享一篇关于Oracle中的SUM用法讲解,小编觉得内容挺不错的,现在分享给大家,具有很好的参考价值,需要的朋友一起跟随小编来看看吧
oracle 存储过程 基础
case 语句 case语句如果作为分支控制语句,最后结束语句是end case,如果是作为select语句里的控制语句则只需要end。
SQL和oracle语句大全
是sql的一些基础的语句,还有一些oracle的语句,仅供参考。


