src: |
  ( SELECT DISTINCT 'PO'::text || t_poles_oap.oid::text AS oid,
      (t_poles_oap.code::text || ' '::text) || t_poles_oap.texte::text AS texte,
      '1'::text AS level,
      t_poles_oap.code
     FROM pmsi.t_poles_oap,
      pmsi.t_lignes_oap,
      pmsi.t_ghm
    WHERE t_ghm.ligne_oap_id = t_lignes_oap.oid AND t_lignes_oap.pole_oap_id = t_poles_oap.oid AND (t_ghm.oid IN ( SELECT p_oids.oid
             FROM pmsi.p_oids
            WHERE p_oids.code_table::text = 'ghm'::text))
    ORDER BY ('PO'::text || t_poles_oap.oid::text), ((t_poles_oap.code::text || ' '::text) || t_poles_oap.texte::text), '1'::text, t_poles_oap.code)
  UNION
  ( SELECT DISTINCT 'LO'::text || t_lignes_oap.oid::text AS oid,
      (t_lignes_oap.code::text || ' '::text) || t_lignes_oap.texte::text AS texte,
      '2'::text AS level,
      t_lignes_oap.code
     FROM pmsi.t_lignes_oap,
      pmsi.t_ghm
    WHERE t_ghm.ligne_oap_id = t_lignes_oap.oid AND (t_ghm.oid IN ( SELECT p_oids.oid
             FROM pmsi.p_oids
            WHERE p_oids.code_table::text = 'ghm'::text))
    ORDER BY ('LO'::text || t_lignes_oap.oid::text), ((t_lignes_oap.code::text || ' '::text) || t_lignes_oap.texte::text), '2'::text, t_lignes_oap.code)
    ORDER BY 4, 3;