src: |
  SELECT 'G'::text || t_types_tiers_payant.code::text AS oid,
      (t_types_tiers_payant.code::text || ' - '::text) || t_types_tiers_payant.texte AS texte,
      t_types_tiers_payant.code AS type_tiers_payant,
      ''::text AS code_tiers_payant,
      '1'::text AS level
     FROM activite.t_types_tiers_payant
  UNION
   SELECT 'T'::text || t_tiers_payant.oid::text AS oid,
      (t_tiers_payant.code || ' - '::text) || t_tiers_payant.texte AS texte,
      t_tiers_payant.type_tiers_payant,
      t_tiers_payant.code AS code_tiers_payant,
      '2'::text AS level
     FROM activite.t_tiers_payant
    WHERE t_tiers_payant.oid <> 0 AND (t_tiers_payant.oid IN ( SELECT p_oids.oid
             FROM activite.p_oids
            WHERE p_oids.code_table = 'tiers_payant'::text))
    ORDER BY 3, 4;