src: |
  SELECT ('LC'::text || to_char(t_classes.sequence, 'FM00'::text)) || t_classes.oid::text AS oid,
      t_classes.texte,
      '2'::text || btrim(rpad(to_char(t_classes.sequence, 'FM00'::text), 10, ' '::text)) AS code,
      '1'::text AS level,
          CASE
              WHEN t_classes.is_cti = '1'::bpchar THEN '1'::character(1)
              ELSE '0'::character(1)
          END AS is_cti
     FROM activite.t_classes,
      activite.t_listes_tables
    WHERE t_classes.table_id = t_listes_tables.oid AND t_listes_tables.code = 'ETATSEJOUR'::text
  UNION ALL
   SELECT ('LS'::text || to_char(t_classes.sequence, 'FM00'::text)) || t_classes_sections.oid::text AS oid,
      t_classes_sections.texte,
      '2'::text || btrim(rpad(to_char(t_classes.sequence, 'FM00'::text), 10, ' '::text) || t_classes_sections.code) AS code,
      '2'::text AS level,
          CASE
              WHEN t_classes.is_cti = '1'::bpchar THEN '1'::character(1)
              ELSE '0'::character(1)
          END AS is_cti
     FROM activite.t_classes,
      activite.t_classes_sections,
      activite.t_listes_tables
    WHERE t_classes.table_id = t_listes_tables.oid AND t_classes_sections.classe_id = t_classes.oid AND t_listes_tables.code = 'ETATSEJOUR'::text
  UNION ALL
   SELECT 'DT'::text || t_etat_sejour.oid::text AS oid,
      (t_etat_sejour.code || ' '::text) || t_etat_sejour.texte AS texte,
      '9'::text || t_etat_sejour.code AS code,
      '1'::text AS level,
      '0'::character(1) AS is_cti
     FROM activite.t_etat_sejour
    ORDER BY 3;