例如:
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 怎样求得两个相除数的最简分数?
- 求大神、本人数据库菜鸟
- oracle将什么复制到回滚段??
- 数据表NUMBER型列中插入double型数据ORA-01426:数字溢出怎么回事?
- 有个笛卡尔积的问题想请教一下
- 协助写个触发器(有测试数据)
- ORACEL sql语句实现根据前条记录的两个字段与下条记录的两个字段值相同时,上条的某个字段值为下条记录的某个字段值。
- 新手赐教,怎么更好的学习oracle,按什么顺序?
- oracle 50W数据,查询要好几分钟,怎么优化数据库?
- 关于外键的建立问题
- 为什么2个计算条件的结果都是FALSE?
- 遇到join on的条件加括号和不加括号的区别,百思不得其解,求高人指点
select a.id,v.catalog
from bom a,cux b
where a.id=b.id
and v.catalog NOT LIKE
DECODE(dalei, '设备', '%材料%建筑%', '材料', '%设备%建筑%', '建筑', '%设备%材料%')
order by a.id;