我在更新多个表中的多行和连接多个列时遇到问题,我必须更新名为policy的表中的到期日期,并为当前具有强制策略的所有员工提供名为rating_record的表中费率的10%折扣。我可以给符合所有条件的10%的折扣,但不知道如何更新到期日期-请帮助!
到目前为止,我的代码是我必须使用第二个更新函数将所有员工的到期日期设置为1月31日。这需要在Oracle 10g中使用SQL developer来完成
update rating_record
set rate=(rate-(100/10)) where exists
(select rating_record.rate from
rating_record, coverage, policy, insured_by, client, person, staff
where
staff.pid = person.pid and
client.pid = person.pid and
client.cid = insured_by.cid and
policy.pno = insured_by.pno and
policy.pno = coverage.pno and
coverage.coid = rating_record.coid and
policy.status = 'E');
发布于 2012-12-08 09:04:42
在update语句中,只能更新一个基表中的值。相反,您应该创建一个过程,并在一个事务中包装两个update语句(每个要更新的表一个)。
https://stackoverflow.com/questions/13769986
复制相似问题