oracle 存储过程异常

我举个一下例子,请各位帮帮忙,执行的是个存储过程
create table a(id number ,customer_name varchar2);

create table b(id number ,customer_name varchar2);

select a.id as id from a

minus

select b.id as id from b

结果集 假如 为  3个不同的值吧 ,id 分别为 12 , 13,  14

然后有个表是 create table c (id number,a_id number);

我执行,delete from c where c.a_id = 上面两个表minus的结果集,因为这都是在存储过程中执行的,偏偏就删除了2条数据,

而不是3条数据,我想请大家说一下这是什么情况造成的
标签: 暂无标签
vipfbi123

写了 10 篇文章,拥有财富 235,被 1 人关注

转播转播 分享分享 分享淘帖
回复

使用道具

P4 | 发表于 2012-8-17 09:56:56
1、"delete from c where c.a_id = 上面两个表minus的结果集",这里使用"="合理吗?应该是"in"吧。
2、看看c表里数据, 12 , 13,  14都包含吗?如果只包含其中2个各1条,或着其中1个存在2条,当然只能删除2条数据。
回复

使用道具

P4 | 发表于 2012-8-17 13:04:30
因为那个是  for c in()loop,是个循环执行的,所以肯定是''='',还有的确是三条数据都有,只不过我的存储过程执行的是5000多条里面,大概有200个要删除的,是不是数据太多,有的数据遗漏了
回复

使用道具

您需要登录后才可以回帖 登录 | 加入社区

本版积分规则

意见
反馈