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
|
mhouri > drop table t_emp purge;
Table dropped.
mhouri > create table t_emp as select * from emp;
Table created.
mhouri > MERGE INTO t_emp
2 using (select
3 b.empno
4 ,b.ename
5 ,b.job
6 ,b.mgr
7 ,b.hiredate
8 ,b.sal
9 ,b.comm
10 ,b.deptno
11 from
12 emp b) e
13 ON (e.empno = t_emp.empno)
14 WHEN MATCHED THEN
15 update
16 set t_emp.sal = e.sal ,
17 t_emp.comm = e.comm
18 where
19 t_emp.deptno != e.deptno
20 and t_emp.mgr != e.mgr
21 and t_emp.hiredate != e.hiredate
22 ;
0 rows merged.
mhouri > update t_emp
2 set mgr = 7698
3 , hiredate = sysdate
4 , deptno = 30
5 where empno = 7369;
1 row updated.
mhouri > MERGE INTO t_emp
2 using (select
3 b.empno
4 ,b.ename
5 ,b.job
6 ,b.mgr
7 ,b.hiredate
8 ,b.sal
9 ,b.comm
10 ,b.deptno
11 from
12 emp b) e
13 ON (e.empno = t_emp.empno)
14 WHEN MATCHED THEN
15 update
16 set t_emp.sal = e.sal ,
17 t_emp.comm = e.comm
18 where
19 t_emp.deptno != e.deptno
20 and t_emp.mgr != e.mgr
21 and t_emp.hiredate != e.hiredate
22 ;
1 row merged. |
Partager