Oracle多表关联如何更新多个字段
2017-09-20 11:21
344 查看
注意点:
1、被update主表一定要加上过滤条件。
2、查询出来更新结果集,同时也要作为被更新主表的条件,作为同步大家都是更新这部分数据。
update student stu
set (stu.name,stu.sex) =
(select bak.name,bak.sex
from student_bak bak
where bak.id = stu.id
and stu.age = 20
)
where exists (select 1
from student_bak bak
where bak.id = stu.id
and stu.age = 20
)
1、被update主表一定要加上过滤条件。
2、查询出来更新结果集,同时也要作为被更新主表的条件,作为同步大家都是更新这部分数据。
update student stu
set (stu.name,stu.sex) =
(select bak.name,bak.sex
from student_bak bak
where bak.id = stu.id
and stu.age = 20
)
where exists (select 1
from student_bak bak
where bak.id = stu.id
and stu.age = 20
)
相关文章推荐
- JAVA如何更新oracle clob字段数据
- Oracle两表关联(join)更新字段值一张表到另一张表
- Oracle两表关联(join)更新字段值一张表到另一张表
- oracle 多表关联更新,需要更新的字段在另一个表里(lfn)
- 如何批量更新oracle库中时间型字段的日期部分
- oracle 多表关联更新,需要更新的字段在另一个表里
- 如何oracle 某一用户授予查询另一个用户某张表的权限,以及更新另一用户表中某些字段
- Oracle如何在update中多表关联更新
- 如何在oracle中设置字段自动增长
- Oracle中如何实现Mysql的两表关联update操作
- hibernate映射数据库表如何使表中字段默认值生效(如更新当传来的值为null时不替换表中值)
- 如何向 Oracle 表中的 Date 字段插入日期及时间
- oracle 如何使字段值自加
- oracle一张表的id关联另一张表中的字段
- Oracle 如何修改表中字段顺序?
- Oracle EBS - OM: 如何对销售定单行界面进行DataLoad,唯一性字段“Line”是非数据库字段,F11不可输入
- 如何对CLOB字段进行全文检索和oracle中大文字量的处理
- 更新操作如何防止带外键的字段出现重复,代码实现方法
- Oracle中如何更新一张大表记录
- Oracle多表关联更新的方式选择