oracle中游标的where条件中可以有case when 语句吗,具体写法是什么?

daijingbo1987 daijingbo1987 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
例如:
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语句?

急啊,麻烦各位了!
...全文
评论 7
收藏 已收藏
分享
返回顶部
daijingbo1987
Oracle 17,133 成员 55,258 内容