select a.*,
to_char(hdat, 'yyyy/mm/dd') as d_hdat,
to_char(chgreg, 'yyyy/mm/dd hh24:mi') as d_chgreg,
to_char(chgupd, 'yyyy/mm/dd hh24:mi') as d_chgupd,
to_char(chgstp, 'yyyy/mm/dd hh24:mi') as d_chgstp,
decode(a.chgstp, null, '0', '1') as stpflg
from afm08 a
where a.chgcd = :chgcd
