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
| merge into MIG_ACTEUR a
using
(select
MCRA.CYC_BODY_NB,
MCRA.MIG_ID_ACTEUR,
MCRA.CD_CODSYS,
TBODY.NB_HOME_PHONE,
TBODY.NB_TEL_PRO,
TBODY.NB_CONTACT_PHONE,
TBODY.NB_MOBILE_TEL,
TBODY.NB_FAX,
CASE
when TBODY.NAF2008_CD is NULL THEN TBODY.NB_NAT_CMPNY ELSE TBODY.NAF2008_CD end VAL_NAF
from TBODY TBODY, MIG_CORR_REF_ACTEUR MCRA
where TBODY.NB = MCRA.CYC_BODY_NB
and (TBODY.NB_HOME_PHONE is not null
or TBODY.NB_TEL_PRO is not null
or TBODY.NB_CONTACT_PHONE is not null
or TBODY.NB_MOBILE_TEL is not null
or TBODY.NB_FAX is not null)
) b
on (A.MIG_ID_ACTEUR=b.MIG_ID_ACTEUR)
when matched then
update set
S_VAL_TEL_PERSO = b.NB_HOME_PHONE,
S_VAL_TEL_PRO = b.NB_TEL_PRO,
S_VAL_TEL_CONTACT = b.NB_CONTACT_PHONE,
S_VAL_TEL_POR = b.NB_MOBILE_TEL,
S_VAL_NUM_FAX = b.NB_FAX,
S_VAL_NAF = b.VAL_NAF ,
VAL_REF_SOURCE = substr(VAL_REF_SOURCE,1,12)||'_'||B.CYC_BODY_NB |
Partager