src: |
  SELECT 'IC'::text || t_ipa.categorie_oid::text AS code,
          CASE
              WHEN t_ipa.categorie_code <> ''::bpchar THEN (t_ipa.categorie_code::text || ' - '::text) || t_ipa.categorie_texte
              ELSE 'Non saisi'::text
          END AS texte,
          CASE
              WHEN t_ipa.categorie_code <> ''::bpchar THEN (t_ipa.categorie_code::text || ' - '::text) || t_ipa.categorie_texte_court
              ELSE 'Non saisi'::text
          END AS texte_court,
      1 AS level
     FROM base.t_ipa
    WHERE t_ipa.oid <> 0
  UNION
   SELECT 'SC'::text || t_ipa.categorie_oid::text AS code,
          CASE
              WHEN t_ipa.categorie_code <> ''::bpchar THEN (('SAUF '::text || t_ipa.categorie_code::text) || ' - '::text) || t_ipa.categorie_texte
              ELSE 'SAUF Non saisi'::text
          END AS texte,
          CASE
              WHEN t_ipa.categorie_code <> ''::bpchar THEN (('SAUF '::text || t_ipa.categorie_code::text) || ' - '::text) || t_ipa.categorie_texte_court
              ELSE 'SAUF Non saisi'::text
          END AS texte_court,
      1 AS level
     FROM base.t_ipa
    WHERE t_ipa.oid <> 0
  UNION
   SELECT 'II'::text || t_ipa.oid::text AS code,
          CASE
              WHEN t_ipa.code::bpchar <> ''::bpchar THEN (t_ipa.code || ' - '::text) || t_ipa.texte
              ELSE 'Non saisi'::text
          END AS texte,
          CASE
              WHEN t_ipa.code::bpchar <> ''::bpchar THEN (t_ipa.code || ' - '::text) || t_ipa.texte_court
              ELSE 'Non saisi'::text
          END AS texte_court,
      2 AS level
     FROM base.t_ipa
    WHERE t_ipa.oid <> 0
  UNION
   SELECT 'SI'::text || t_ipa.oid::text AS code,
          CASE
              WHEN t_ipa.code::bpchar <> ''::bpchar THEN (('SAUF '::text || t_ipa.code) || ' - '::text) || t_ipa.texte
              ELSE 'SAUF Non saisi'::text
          END AS texte,
          CASE
              WHEN t_ipa.code::bpchar <> ''::bpchar THEN (('SAUF '::text || t_ipa.code) || ' - '::text) || t_ipa.texte_court
              ELSE 'SAUF Non saisi'::text
          END AS texte_court,
      2 AS level
     FROM base.t_ipa
    WHERE t_ipa.oid <> 0
    ORDER BY 2;