gtx950巫师3:oracle用plsql远程连接服务器 进行操作update,突然停电了,请问

来源:百度文库 编辑:中科新闻网 时间:2024/04/29 21:29:27
1.oracle用plsql远程连接服务器 进行操作update,突然停电了,请问
update能成功吗?
2.update后不commit有什么结果?

*3.一个update语句

update base_crmperson a set
(a.attachdepart, a.areacode)=
(select b.attachdepart, b.areacode from base_crmuserinfo_bak_11 b
where a.syscustcode=b.syscustcode
)
a表600w记录,b表40w记录 a,b两个表通过syscustcode关联,syscustcode在两个表中都是全表唯一的。请问为什么update了600w记录而不是40w记录?
真的假的 ?
update错了可是很严重的哦。能不能提供点确切的材料啊,先谢了
我试验了一下 不是这样子的哦,其他不符合条件的a.attachdepart, a.areacode两个字段变成空值了。。
我知道了应该这么写
update base_crmperson a set
(a.attachdepart, a.areacode)=
(select b.attachdepart, b.areacode from base_crmuserinfo_bak_11 b
where a.syscustcode=b.syscustcode
) where exists
(select b.syscustcode from base_crmuserinfo_bak_11 b wherea.syscustcode=b.syscustcode )
这是oracle和sybase不一样的地方

首先你update的是表a
update的是候执行的是600W记录,是对600W条记录都更新了的,而更新的内容是如果不合条件就保持原来的,但也是一种更的操作只不过是记录不变吧,而变的只是符合条件的记录.