一个有难度的sql.如何构造 update B set B.num = A.numfrom A,Bwhere A.id = B.id;commit; 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 这样:update B set num= (select num from A where A.id=B.id) where exists (select 'X' from A where A.id=B.id) beginfor a in (select id ,num from a )loopupdate bset num = a.num where id = a.id;end loop;commit;end; to : yefengdn(我爱我家) ora8i的版本可以这样写吗??ora9i的版本也可以吗?? yefengdn(我爱我家)的是错的sql hrb_qiuyb(晨钟暮鼓) 的能执行过但数据没有被移植.haifeng1012(海风)的没测试,觉得不是最优的sql.不晓得还有不有方法 在oracle中更新语句中不能同时连接两个表,所以我用游标实现!!还有其他的方法吗??studying... update b set num=(select num from a where a.id=b.id);这样应该可以了!!如果没有别的要求欧!! to hrb_qiuyb(晨钟暮鼓):update B set num= (select num from A where A.id=B.id)就可以了为什么要加where exists (select 'X' from A where A.id=B.id)呢??????????? to : chinadrencher(南海的天)你测试过update b set num=(select num from a where a.id=b.id);语句了,能实现你要的功能吗?? update B set num= (select num from A where A.id=B.id)对啊,就够了:) update B set num= (select num from A where A.id=B.id)如果A 中没有重复的id就行 oracle 表结构导入导出问题 ora-00604/ora-04031错误 存储过程问题 OVER() 在9i、8i中都能用吗?有没有限制? 如何实现从access数据导入到oracle 如何在OMS下进行数据备份、导出,都能到向导了,进行完后,在作业看发现是失败的, 存储过程的问题 怎么安装oraoledb.oracle 请问oracle支持双向的游标吗?如果不支持,那些连接到oracle的记录集是如何实现movenext, moveprev双向的? ora-12638:凭证检索失败的解决办法? SQL语句---不变的话题 请问SQL外关联的问题
update B set num=
(select num from A where A.id=B.id)
where exists
(select 'X' from A where A.id=B.id)
for a in (select id ,num from a )
loop
update b
set num = a.num
where id = a.id;
end loop;
commit;
end;
ora8i的版本可以这样写吗??
ora9i的版本也可以吗??
的是错的sql hrb_qiuyb(晨钟暮鼓) 的能执行过
但数据没有被移植.haifeng1012(海风)的没测试,觉得不是最优的sql.不晓得还有不有方法
还有其他的方法吗??
studying...
(select num from A where A.id=B.id)就可以了
为什么要加
where exists
(select 'X' from A where A.id=B.id)
呢???????????
你测试过update b set num=(select num from a where a.id=b.id);语句了,能实现你要的功能吗??
(select num from A where A.id=B.id)对啊,就够了:)
(select num from A where A.id=B.id)
如果A 中没有重复的id就行