1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
|
mhouri.world > create table table1(cgest number, c varchar2(10));
Table created.
mhouri.world > create table table2(cgest number, c varchar2(10));
Table created.
mhouri.world > insert into table1 values (1, 'bla');
1 row created.
mhouri.world > insert into table1 values (1, 'blu');
1 row created.
mhouri.world > insert into table1 values (1, 'blo');
1 row created.
mhouri.world > insert into table1 values (1, 'bli');
1 row created.
mhouri.world > insert into table2 values (1, 'bla');
1 row created.
mhouri.world > insert into table2 values (1, 'blu');
1 row created.
mhouri.world > insert into table2 values (1, 'blo');
1 row created.
mhouri.world > commit;
Commit complete.
mhouri.world >ed
Wrote file afiedt.buf
1 insert into table2
2 select * from table1 t1
3 where t1.cgest = 1
4 and not exists (select null
5 from table2 t2
6 where t2.cgest = t1.cgest
7 and t2.c = t1.c
8* )
mhouri.world >/
1 row created.
mhouri.world > commit;
Commit complete.
mhouri.world > select * from table1;
CGEST C
---------- ----------
1 bla
1 blu
1 blo
1 bli
mhouri.world > select * from table2;
CGEST C
---------- ----------
1 bla
1 blu
1 blo
1 bli |