首页 > 代码库 > 高级dml操作,insert操作

高级dml操作,insert操作

drop table e1 purge;

drop table e2 purge;

create table e1 as select ename,sal,hiredate

from emp where 9=0;

create table e2 as select ename,deptno,mgr

from emp where 9=0;

insert all

into e1 values(ename,sal,hiredate)

into e2 values(ename,depno,mgr)

select ename,sal,hiredate,deptno,mgr

from emp where depno=10;

select * from e1;

select * from e2;

all的含义为:emp表中的一行将插入到e1,e2中

 

insert first

when sal>3000 then

into e1 values(enames,sal,hiredate)

when sal>2000 then

into e2 values(ename,deptno,mgr)

select ename,sal,hiredate,deptno,mgr

from emp;

first 的含义为:一行只能给一张表,即使两个表的条件都符合。