ITPub博客

首页 > Linux操作系统 > Linux操作系统 > oracle update的变种写法

oracle update的变种写法

原创 Linux操作系统 作者:sieper 时间:2010-09-16 11:35:10 0 删除 编辑

create table a (id int ,name int);

create table b (id int ,name int);

select  * from a
select  * from b

insert into a
select 1,11 from dual

insert into b
select 1,22 from dual

 

变种一

update a set (a.id,a.name) = (select id ,name from b where a.id=b.id)

select  * from a

变种二

 

update (select  * from a where a.id=1) set (id,name)=(select id,name from b where b.id=1)

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/11813230/viewspace-674122/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2009-03-17

  • 博文量
    87
  • 访问量
    210535