Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/83.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/oracle/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql 加载目标,更新源表中的第二行_Sql_Oracle_Oracle11g - Fatal编程技术网

Sql 加载目标,更新源表中的第二行

Sql 加载目标,更新源表中的第二行,sql,oracle,oracle11g,Sql,Oracle,Oracle11g,源表 id name age 1 a 25 1 a 25 1 a 25 目标表 id name age 1 a 25 1 a 30 1 a 25 帮助我找出这个查询您应该使用merge语句 Merge into target using source on target.id = source.id --and target.name = source.name --if needed when matched then update set target.age=source

源表

id name age
1 a  25
1 a  25
1 a  25
目标表

id name age
1 a  25
1 a  30
1 a  25

帮助我找出这个查询

您应该使用merge语句

Merge into target
using source
on target.id = source.id --and target.name = source.name --if needed
when matched then update 
set target.age=source.age;

但是:源中的行必须具有唯一标识符(它可能由多个列组成)。例如,要运行我的查询,需要source.id是唯一的。

您没有提供足够的信息