Oracle中用乙個表的資料更新另乙個表的資料

2021-08-20 19:00:49 字數 1077 閱讀 8896

更新完後的結果是:select * from tab1,在tab1中有的行,如果在tab2中沒有對應的行,值被更新為null. 

比如在tab2中再插入一條 insert into tab2 values(2,』***x』)

merge

into tab1

using (select * from tab2 x where x.rowid =

(select

max(y.rowid) from tab2 y where x.id = y.id)) tab2

on(tab1.id=tab2.id)

when

matched

then

update

set tab1.val = tab2.val

oracle將乙個表資料插入到另乙個表

一 插入部分表資料,示列 將table name new表中五個字段對應插入到table name表中,where後面是條件判斷可去掉 where forgid 0 插入指定行資料 insert into table name t t.val1,t.val2,t.val3,t.val4,t.val5...

oracle把乙個表的資料複製到另乙個表中

新增乙個表,通過另乙個表的結構和資料 create table table1 as select from table2 如果表存在 insert into table1 select from table2 同乙個表中,將a欄位的值賦給b欄位 update table name set b a 將...

Oracle查詢乙個表的資料插入到另乙個表

1.新增乙個表,通過另乙個表的結構和資料 create table xthame.tab1 as select from dsknow.combdversion 2.如果表存在 insert into tab1 select from tab2 3.同乙個表中,將a欄位的指賦給b欄位 update ...