select a.spnm,a.spnms,a.spcls,a.spknm,a.shflg,a.shfdt,a.biko,
        a.spknms,a.spprio,a.spscm,
        a.spzip, a.spad1,a.spad2,a.spkad1,a.spkad2,a.sptel,a.spfax,a.splct,
        a.cuspcd,a.cusycd,a.cuedi,
        a.spslcd,b.chgnm spslnm,a.spslcd2,c.chgnm spslnm2,a.spbscd,d.chgnm spbsnm,a.spktcd,e.ktktnm spktnm,a.cuspkf,
        a.cuclcls,a.cupcls,a.cupdt,a.cupmn,a.cupycls,
        a.cshcd,f.cshnm,a.com,a.spbucn,a.dcubcd,a.dcls,a.spcat,a.splnk,a.vdlmt,a.cllmt,a.plcd,a.plhocd,a.pladcd,
        a.spsnm,a.spsnmk,a.spszip,a.spsad1,a.spsad2,a.spskad1,a.spskad2,a.spstel,a.spsfax,
        to_char(spreg,'yyyy/mm/dd hh24:mi') reg,
        to_char(spupd,'yyyy/mm/dd hh24:mi') upd,
        to_char(spstp,'yyyy/mm/dd hh24:mi') stp
from afm036 f,afm05 e,afm08 d,afm08 c,afm08 b,afm032 a
where a.cucd	= :cucd   and a.cuscd = :cuscd
and a.spslcd	= b.chgcd(+)
and a.spslcd2	= c.chgcd(+)
and a.spbscd	= d.chgcd(+)
and a.spktcd	= e.ktktcd(+)
and a.cucd	= f.cucd(+) and a.cshcd = f.cshcd(+)