select 
  a.ktktcd, a.ktktnm, a.ktktnk,a.ktcls,
  a.ktzip,a.ktad1,a.ktad2,a.kttel,a.ktfax,
	a.constr,a.dbuser,a.dbpass,a.hstr,a.sdno,a.sdcd,a.ipsegadr,
	a.constr2,a.dbuser2,a.dbpass2,a.hstr2,
	a.htcls,a.htpnt1,a.htpnt2,a.htlmt1,a.htlmt2,
	to_char(a.tday,'yyyy/mm/dd') tday,a.nyflg,
	to_char(a.reg,'yyyy/mm/dd hh24:mi') reg,
	to_char(a.upd,'yyyy/mm/dd hh24:mi') upd,
	to_char(a.stp,'yyyy/mm/dd hh24:mi') stp,
	a.ruktcd,b.ktktnm ruktnm
from  afm05 b,afm05 a
where a.ktktcd = :ktktcd
  and a.ruktcd=b.ktktcd(+)