select a.*,
TO_CHAR(a.reg, 'yyyy/mm/dd hh24:mi') as d_reg,
TO_CHAR(a.upd, 'yyyy/mm/dd hh24:mi') as d_upd,
TO_CHAr(a.stp, 'yyyy/mm/dd hh24:mi') as d_stp,
decode(a.stp, null, '0', '1') as stpflg
from afm04 a
where a.mcd = :inpcd
