ITPub博客

首页 > 数据库 > Oracle > insert all , insert first 使用多表插入

insert all , insert first 使用多表插入

Oracle 作者:大_米 时间:2015-02-01 14:28:39 0 删除 编辑



insert all
into SAL_HISTORY values (ename,hiredate,sal)
into MGR_HISTORY values (ename,mgr,sal)
select ename,hiredate,mgr,sal from emp;

insert all
when sal>1000 then
into SAL_HISTORY values (ename, hiredate,sal)
when mgr>7700 then
into MGR_HISTORY values (ename,mgr,sal)
select ename,hiredate,mgr,sal from emp;


insert first
when sal>3000 then
into SAL_HISTORY values (ename,hiredate,sal)
when sal>1000 then
into MGR_HISTORY values (ename,mgr,sal)
select ename,hiredate,mgr,sal from emp;

如果某行数据满足第一个when子句的条件,那么随后when子句会跳过该行数据。


create table mgr_history
as select ename,mgr,sal from emp where 1=2;

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

上一篇: 三范式
请登录后发表评论 登录
全部评论

注册时间:2015-01-03

  • 博文量
    19
  • 访问量
    36457