cursor XX is
select * from table;
能不能加条件判断?
如 cursor XX is
if (a=1) then
select * from table1;
elsif (a=2) then
select * from table2;
end if;
oracle 存储过程cursor xxx is后面的select 语句能加判断条件得出吗?
答案:2 悬赏:50
解决时间 2021-03-14 22:13
- 提问者网友:月葬花瑰
- 2021-03-14 00:11
最佳答案
- 二级知识专家网友:晨与橙与城
- 2021-03-14 00:56
不能那样写,但是可以这样写
cursor xx is
SELECt case a when 1 then t1.field1, t1.field2, t1.field3...t1.fieldn
when 2 then t2.field1, t2.field2, t2.field3...t2.fieldn
ELSE NULL END
FROM table1 t1, table2 t2
cursor xx is
SELECt case a when 1 then t1.field1, t1.field2, t1.field3...t1.fieldn
when 2 then t2.field1, t2.field2, t2.field3...t2.fieldn
ELSE NULL END
FROM table1 t1, table2 t2
全部回答
- 1楼网友:一只傻青衣
- 2021-03-14 01:06
如果是查询条件,可以用case when 构建,表的话好像没什么好办法
我要举报
如以上问答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯