/* Custom Template for extracting HasPMI flag
  #New: 02.03.2023/Chris+J.Fes
  Test obj :para_DsPuid '9WsNQr9JxrUHOD'
*/
select
--pw.PBS4_F_TB_S_01 AS HasPMI1,
(case when upper(pw.PBS4_F_TB_S_01) = 'TRUE' then 'Y' else 'N' end) as HasPMI
 from
  infodba.PREF_LIST_0 rl
  inner join infodba.PFORM pf on (pf.puid = rl.pvalu_0)
  inner join infodba.PXXX_TITLEBLOCK_CLASS pw on (pf.rdata_fileu = pw.puid)
where
  rl.puid = :para_DsPuid
