1 2 3 4 5 6 7 8 9 10 11 12 13
| MERGE INTO table1
USING (select titi,
toto,
decode(table2.DATE_S,'2004',table2.toto,null) c1,
decode(table2.DATE_S,'2005',table2.toto,null) c2,
decode(table2.DATE_S,'2006',table2.toto,null) c3,
decode(table2.DATE_S,'2007',table2.toto,null) c4,
decode(table2.DATE_S,'2008',table2.toto,null) c5,
decode(table2.DATE_S,'2009',table2.toto,null) c6
from table2) table2
ON (table1.titi= table2.titi and table1.tutu = table2.tutu)
WHEN MATCHED THEN UPDATE table1 (champ1,champ2,champ3,champ4,champ5,champ6)
values (table2.c1,table2.c2,table2.c3,table2.c4,table2.c5,table2.c6) |