오라클 9i 부터 제공되는 multi-table insert 방법
방법 1)
1 2 3 4 5 6 7 |
insert all into job_yr_sal values (job, cnt, tot_sal) into job_av_com values (job, cnt, avg_com) select job, count(*), k sum(sal) tot_sal, avg(comm) avg_com from emp, dept where emp.deptno = dept.deptno group by job; |
방법 2)
1 2 3 4 5 6 7 |
insert all when deptno in (select deptno from dept) then into regular_emp values (empno, ename, deptno) when job in ('CLERK', 'SAQLESMAN') then into sale_emp values (empno, ename, job) select empno, ename, job, deptno from emp; |
방법 3)
1 2 3 4 5 6 7 |
insert first when sal>10000 then into special_empno values (empno, sal) when sal>5000 then into normal_empno values (empno, sal) when sal>3000 then into normal_empno values (empno, sal) else into low_empno values (empno, sal) select empno, sal from emp; |