Code :
- FOR r IN (
- select c.ct_code,
- c.mo_code,
- c.ct_libelle,
- c.ct_type_local
- from tmp_chantier c
- where c.ct_type_local = 'D' -- regle IMP-N1
- and (
- ( c.et_code in (select code_ctc from ctc where c.et_code = ctc.code_ctc)
- and c.ct_code in (select code_cd from chantier_directeur cd where c.ct_code = cd.code_cd)
- ) -- regle IMP-N2
- or
- ( c.ct_code in (select code_cd from chantier_directeur cd where c.ct_code = cd.code_cd)
- and c.uo_code = -1
- ) -- regle IMP-N1
- or
- ( c.et_code in (select code_ctc from ctc where c.et_code = ctc.code_ctc)
- and c.uo_code = -1
- ) -- regle IMP-N1
- )
- )
- LOOP
-
-
-
- insert into chantier_directeur (id_chantier_directeur,
- id_ctc,
- code_cd,
- code_mod_cd,
- libelle_cd,
- flag_import)
- values(chantier_directeur_seq.nextval,
- r.id_ctc,
- r.ct_code,
- r.mo_code,
- r.ct_libelle,
- 1);
- END LOOP;
|