Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/oracle/9.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
Oracle 从临时表更新到原始表_Oracle - Fatal编程技术网

Oracle 从临时表更新到原始表

Oracle 从临时表更新到原始表,oracle,Oracle,我有两个表,一个是原始表,另一个是临时表。具有正确记录的临时表。唯一列是cust_id。我的表结构是 客户表 cust_id amount 12 100 13 120 14 130 15 250 20 70 25 110 28 900 temp table cust_id amount 12 300 13 190 14 110 15 240 20

我有两个表,一个是原始表,另一个是临时表。具有正确记录的临时表。唯一列是cust_id。我的表结构是

客户表

cust_id  amount
12       100
13       120
14       130
15       250
20        70
25       110
28       900

temp table 

cust_id  amount
12       300
13       190
14       110
15       240
20        30
25       210
28       500
我想使用客户id将记录从临时表更新到客户原始表。

可以使用语句完成

merge into original_table ot
using temp_table tp
  on (ot.cust_id = tp.cust_id)
when matched 
then update set ot.amount = tp. amount

有什么问题吗?我不知道请告诉我你没有尝试过