Tuesday, May 24, 2011

INSERT MULTIPLE TABLE BY SINGLE QUERRY

-- Inserting multiple table using one single querry
-- Inserting master and chield table at a time using one single querry

insert all
when type = 'MASTER' then
into scott.mst(id, des)
values(id, des)
when type = 'DET' then
into scott.emp(empno, sal)
values(empno, sal)
select 11 id, 'new' des,1 empno,2 sal, 'MASTER' type from dual
union all
select 1,'gg',001 empno, 50 sal, 'DET' type from dual
union all
select 1,'gg', 002 empno, 44 sal, 'DET' type from dual
union all
select 1,'gg',003 empno, 33 sal, 'DET' type from dual
union all
select 1,'gg',004 empno, 44 sal, 'DET' type from dual

No comments:

Post a Comment