dep:
  - v_ages_1
  - v_codes_postaux_2
  - v_destinations_sortie_1
  - v_modes_entree_1
  - v_modes_sortie_1
  - v_provenances_entree_1
src: |
  SELECT p_sejours.oid
     FROM activite.p_sejours
       JOIN activite.v_ages_1 ON v_ages_1.age_id::numeric = p_sejours.age
       JOIN activite.v_codes_postaux_2 ON v_codes_postaux_2.code_postal_id = p_sejours.code_postal_id
       JOIN activite.t_type_sejour ON t_type_sejour.code = p_sejours.type_sejour
       JOIN activite.v_modes_entree_1 ON v_modes_entree_1.mode_entree_code = p_sejours.mode_entree
       JOIN activite.v_provenances_entree_1 ON v_provenances_entree_1.provenance_code = p_sejours.provenance
       JOIN activite.v_modes_sortie_1 ON v_modes_sortie_1.mode_sortie_code = p_sejours.mode_sortie
       JOIN activite.v_destinations_sortie_1 ON v_destinations_sortie_1.destination_code = p_sejours.destination
       JOIN activite.t_ghs_c ON t_ghs_c.ghs_id = p_sejours.ghs_id
       JOIN activite.t_ghm_c ON t_ghm_c.ghm_id = p_sejours.ghm_id
       JOIN activite.t_tiers_payant ON t_tiers_payant.oid = p_sejours.tiers_payant_0_id
       JOIN activite.t_medecins_administratifs_c ON p_sejours.medecin_sejour_id = t_medecins_administratifs_c.oid
       JOIN activite.t_lieux_c ON t_lieux_c.oid = p_sejours.lieu_sortie_id
       JOIN base.t_modes_traitement ON t_modes_traitement.oid = p_sejours.mode_traitement_id
       JOIN activite.t_risque ON t_risque.oid = p_sejours.risque_id
    WHERE p_sejours.etat = ''::bpchar;