首页 > 代码库 > merge的用法
merge的用法
create table t1(
sid integer,
sname varchar2(32),
);
alter table t1 modify gender varchar2(3);
alter table t1 modify sname varchar2(30);
create table t2(
sid integer,
sname varchar2(32)
);
alter table t1 rename column sid to dsi;
insert into t1 values(1,‘hello_what‘);
insert into t1 values(2,‘hi‘);
insert into t2 values(1,‘hello‘);
commit;
select * from t1;
select * from t2;
merge into t2
using (select * from t1) t1
on (t1.dsi = t2.sid)
when matched then update set t2.sname = t1.sname
delete where t2.sid = 1
when not matched then insert (sid,sname) values(t1.dsi,t1.sname)
merge的用法
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。