src: |
  ( SELECT DISTINCT t_medecins.nom,
      t_medecins.prenom,
      ''::text AS nom_adm,
      ''::text AS prenom_adm,
      '1'::text AS level,
      'M'::text || t_medecins.oid::text AS oid,
          CASE
              WHEN t_medecins.oid <> 0 THEN (t_medecins.nom || ' '::text) || t_medecins.prenom
              ELSE 'Non saisi'::text
          END AS texte
     FROM activite.t_medecins_administratifs,
      base.t_medecins
    WHERE (t_medecins_administratifs.oid IN ( SELECT p_oids.oid
             FROM activite.p_oids
            WHERE p_oids.code_table = 'medecin_x'::text)) AND t_medecins_administratifs.medecin_id = t_medecins.oid
    ORDER BY t_medecins.nom, t_medecins.prenom, ''::text, '1'::text, 'M'::text || t_medecins.oid::text,
          CASE
              WHEN t_medecins.oid <> 0 THEN (t_medecins.nom || ' '::text) || t_medecins.prenom
              ELSE 'Non saisi'::text
          END)
  UNION
   SELECT t_medecins.nom,
      t_medecins.prenom,
      t_medecins_administratifs.nom AS nom_adm,
      t_medecins_administratifs.prenom AS prenom_adm,
      '2'::text AS level,
      'A'::text || t_medecins_administratifs.oid::text AS oid,
          CASE
              WHEN t_medecins_administratifs.oid <> 0 THEN ((((t_medecins_administratifs.nom || ' '::text) || t_medecins_administratifs.prenom) || ' ('::text) || t_medecins_administratifs.code) || ')'::text
              ELSE 'Non saisi'::text
          END AS texte
     FROM activite.t_medecins_administratifs,
      base.t_medecins
    WHERE (t_medecins_administratifs.oid IN ( SELECT p_oids.oid
             FROM activite.p_oids
            WHERE p_oids.code_table = 'medecin_x'::text)) AND t_medecins_administratifs.medecin_id = t_medecins.oid
    ORDER BY 1, 2, 3, 4;