1.使用字表查询插入数据
insert into employee (name,num,sal)
select name,num,sql from emp where num between 0 end 20;
当需要加载大量数据的时候,使用
insert /*+APPEND */ into employee (name,num,sal)
select name,num,sql from emp where num between 0 and 20;
2.使用all操作符进行多表插入
当满足条件就将记录插入到表中
insert all
when num = 0 then into dept1
when num = 2 then into dept2
when num = 3 then into dept3
else into otherdept
select * from emp;
3.使用first操作符进行多表插入
当满足第一个条件,就直插入第一个表中
insert first
when num = 0 then into dept1
when num = 2 then into dept2
when num = 3 then into dept3
when sal >8000 then into dept4
else into other
select * from emp;