oracle批量更新问题,表结构如下:
程序中遍历更新update用的多 数据库中没用过 哎
A表 id outno inno state
1 111 5
2 111
3 222 5
4 222
......
B表 id AID(A表ID)
11 1
22 3
......
把B表以前引用的是A表中state为5的ID 更新为A表inno=outno 取inno当前ID
我现在有个想法但是不知道怎么在oracle中编写
首先把所有需要更新的数据查询出来
如:
select sepd.ID,benout.id,benin.id from A benout, A benin, B sepd
where benout.outno= benin.inno
and sepd.aid= benout.id
and benout.state = 5
通过这个结果集 将B表中的 id为sepd.ID的Aid修改为benin.id
有个想法是遍历这个执行update 代码不知如何下手 游标有没实际用过