WITH repl AS ( SELECT * FROM ( VALUES ('GAB12000DE2','GAB12000A34C012LRTOQ'), ('GAB14000DE2','GAB14000A34C012LRTOT'), ('GAB18000DE2','GAB18000A34C006LRTOW'), ('GAB22000DE2','GAB22000A34C006LRTOZ'), ('GAB12000BG3','GAB12000A34C012LRTOQ'), ('GAB14000BG3','GAB14000A34C012LRTOT'), ('GAB18000BG3','GAB18000A34C006LRTOW'), ('GAB22000BG3','GAB22000A34C006LRTOZ'), ('CNA06000A42','CNA06000A50C024LRCGA'), ('CNA08000A42','CNA08000A50C024LRCGC'), ('CNA06000F89','CNA06000A50C024LRCGA'), ('CNA08000F89','CNA08000A50C024LRCGC'), ('CNA10000F89','CNA10000A42C012LRBXI'), ('CNA12000F89','CNA12000A42C012LRBXJ'), ('CNA06000BG3','CNA06000A50C024LRCGA'), ('CNA08000BG3','CNA08000A50C024LRCGC'), ('CNA10000BG3','CNA10000A42C012LRBXI'), ('CNA12000BG3','CNA12000A42C012LRBXJ'), ('CNA06000A10','CNA06000A50C024LRCGA'), ('CNA08000A10','CNA08000A50C024LRCGC'), ('CNA10000A10','CNA10000A42C012LRBXI'), ('CNA12000A10','CNA12000A42C012LRBXJ'), ('CNA30000A10','CNA30000G18C002LRCDG'), ('LIA06000DE2','LIA06000A34C024LRTIV'), ('LIA08000DE2','LIA08000A34C024LRTIZ'), ('LIA10000DE2','LIA10000A34C012LRTJD'), ('LIA12000DE2','LIA12000A34C012LRTJH'), ('LIA14000DE2','LIA14000A34C012LRTJL'), ('LIA16000DE2','LIA16000A34C006LRTJP'), ('LIA20000DE2','LIA20000A34C006LRTJT'), ('LIA24000DE2','LIA24000A34C006LRTJY'), ('LIA06000B78','LIA06000A34C024LRTIV'), ('LIA08000B78','LIA08000A34C024LRTIZ'), ('LIA10000B78','LIA10000A34C012LRTJD'), ('LIA12000B78','LIA12000A34C012LRTJH'), ('LIA14000B78','LIA14000A34C012LRTJL'), ('LIA16000B78','LIA16000A34C006LRTJP'), ('LIA20000B78','LIA20000A34C006LRTJT'), ('LIA24000B78','LIA24000A34C006LRTJY'), ('SLI06000DE2','SLI06000A34C024LRTKB'), ('SLI08000DE2','SLI08000A34C024LRTKF'), ('SLI10000DE2','SLI10000A34C012LRTKJ'), ('SLI12000DE2','SLI12000A34C012LAH13'), ('SLI14000DE2','SLI14000A34C012LAH16'), ('SLI17000DE2','SLI17000A34C012LAH19'), ('SLI20000DE2','SLI20000A34C006LAH24'), ('SLI24000DE2','SLI24000A34C006LRTLD'), ('SLI06000B78','SLI06000A34C024LRTKB'), ('SLI08000B78','SLI08000A34C024LRTKF'), ('SLI10000B78','SLI10000A34C012LRTKJ'), ('SLI12000B78','SLI12000A34C012LAH13'), ('SLI14000B78','SLI14000A34C012LAH16'), ('SLI16000B78','SAA14001A10C006LRCDJ'), ('SLI20000B78','SLI20000A34C006LAH24'), ('SLI24000B78','SLI24000A34C006LRTLD'), ('ECA06000DE2','ECA06000A101009LRCIG'), ('ECA08000DE2','ECA08000A101006LRCID'), ('ECA10000DE2','ECA10000A341020LRCEL'), ('ECA12000DE2','ECA12000A101006LRCIA'), ('ECA16000DE2','ECA16000A34C010LRCEX'), ('ECA20000DE2','ECA20000A341006LRCEU'), ('ECA06000B78','ECA06000A101009LRCIG'), ('ECA08000B78','ECA08000A101006LRCID'), ('ECA10000B78','ECA10000A341020LRCEL'), ('ECA12000B78','ECA12000A101006LRCIA'), ('ECA16000B78','ECA16000A34C010LRCEX'), ('ECA20000B78','ECA20000A341006LRCEU'), ('GDP08000DE2','SAA14001A10C006LRCDJ'), ('GDP08000BG3','SAA14001A10C006LRCDJ'), ('MSA12001DE2','MSA12001A341008LRCFQ'), ('MSA16001DE2','MSA16001A34C004LRAYN'), ('MSA20001DE2','MSA20001A34C004LRCFW'), ('MSA12001A42','MSA12001A341008LRCFQ'), ('MSA16001A42','MSA16001A34C004LRAYN'), ('MSA20001A42','MSA20001A34C004LRCFW'), ('MSA12001B78','MSA12001A341008LRCFQ'), ('MSA16001B78','MSA16001A34C004LRAYN'), ('MSA20001B78','MSA20001A34C004LRCFW'), ('SEA07001DE2','SEA07001B15C008LRAZR'), ('SEA09001DE2','SEA09001B15C008LRAZS'), ('SEA12001DE2','SEA12001B15C006LRAZU'), ('SEA14001DE2','SEA14001B15C006LRAZT'), ('SEA16000DE2','SAA14001A10C006LRCDJ'), ('SEA07001B78','SEA07001B15C008LRAZR'), ('SEA09001B78','SEA09001B15C008LRAZS'), ('SEA12001B78','SEA12001B15C006LRAZU'), ('SEA14001B78','SEA14001B15C006LRAZT'), ('SEA16000B78','SAA14001A10C006LRCDJ'), ('SEA07001A42','SEA07001B15C008LRAZR'), ('SEA09001A42','SEA09001B15C008LRAZS'), ('SEA12001A42','SEA12001B15C006LRAZU'), ('SEA14001A42','SEA14001B15C006LRAZT'), ('SEA16000A42','SAA14001A10C006LRCDJ'), ('VNP18000A42','VNP18000A34C006LRTPN'), ('VNP24000A42','VNP24000A34C006LRTPR'), ('VNP30000A42','VNP30000A34C006LRTPV'), ('VNP18000A10','VNP18000A34C006LRTPN'), ('VNP24000A10','VNP24000A34C006LRTPR'), ('VNP30000A10','VNP30000A34C006LRTPV'), ('SVN18000A42','SVN18000A34C006LRTPZ'), ('SVN24000A42','SVN24000A34C006LRTQD'), ('SVN30000A42','SVN30000A34C006LRTQH'), ('SVN18000A10','SVN18000A34C006LRTPZ'), ('SVN24000A10','SVN24000A34C006LRTQD'), ('SVN30000A10','SVN30000A34C006LRTQH'), ('ASP06000P81','SAA14001A10C006LRCDJ'), ('ASP08000P81','SAA14001A10C006LRCDJ'), ('ASP10000P81','SAA14001A10C006LRCDJ'), ('ASP12000P81','SAA14001A10C006LRCDJ'), ('ASP16000P81','SAA14001A10C006LRCDJ'), ('ASP06000P80','SAA14001A10C006LRCDJ'), ('ASP08000P80','SAA14001A10C006LRCDJ'), ('ASP10000P80','SAA14001A10C006LRCDJ'), ('ASP12000P80','SAA14001A10C006LRCDJ'), ('ASP16000P80','SAA14001A10C006LRCDJ'), ('ASP06000P26','SAA14001A10C006LRCDJ'), ('ASP08000P26','SAA14001A10C006LRCDJ'), ('ASP10000P26','SAA14001A10C006LRCDJ'), ('ASP12000P26','SAA14001A10C006LRCDJ'), ('ASP16000P26','SAA14001A10C006LRCDJ'), ('ASP06000DE3','SAA14001A10C006LRCDJ'), ('ASP08000DE3','SAA14001A10C006LRCDJ'), ('ASP10000DE3','SAA14001A10C006LRCDJ'), ('ASP12000DE3','SAA14001A10C006LRCDJ'), ('ASP16000DE3','SAA14001A10C006LRCDJ'), ('ARP06000P81','SAA14001A10C006LRCDJ'), ('ARP08000P81','SAA14001A10C006LRCDJ'), ('ARP10000P81','SAA14001A10C006LRCDJ'), ('ARP12000P81','SAA14001A10C006LRCDJ'), ('ARP16000P81','SAA14001A10C006LRCDJ'), ('ARP06000P80','SAA14001A10C006LRCDJ'), ('ARP08000P80','SAA14001A10C006LRCDJ'), ('ARP10000P80','SAA14001A10C006LRCDJ'), ('ARP12000P80','SAA14001A10C006LRCDJ'), ('ARP16000P80','SAA14001A10C006LRCDJ'), ('ARP06000P26','SAA14001A10C006LRCDJ'), ('ARP08000P26','SAA14001A10C006LRCDJ'), ('ARP10000P26','SAA14001A10C006LRCDJ'), ('ARP12000P26','SAA14001A10C006LRCDJ'), ('ARP16000P26','SAA14001A10C006LRCDJ'), ('ARP06000DE3','SAA14001A10C006LRCDJ'), ('ARP08000DE3','SAA14001A10C006LRCDJ'), ('ARP10000DE3','SAA14001A10C006LRCDJ'), ('ARP12000DE3','SAA14001A10C006LRCDJ'), ('ARP16000DE3','SAA14001A10C006LRCDJ'), ('ANP12000A39','SAA14001A10C006LRCDJ'), ('ANP15000A39','SAA14001A10C006LRCDJ'), ('ANP17500A39','SAA14001A10C006LRCDJ'), ('CAS12000P26','SAA14001A10C006LRCDJ'), ('CAS15000P26','SAA14001A10C006LRCDJ'), ('CAS12000P80','SAA14001A10C006LRCDJ'), ('CAS15000P80','SAA14001A10C006LRCDJ'), ('CAR12000P26','SAA14001A10C006LRCDJ'), ('CAR15000P26','SAA14001A10C006LRCDJ'), ('CAR12000P80','SAA14001A10C006LRCDJ'), ('CAR15000P80','SAA14001A10C006LRCDJ'), ('SKR12000G27','SAA14001A10C006LRCDJ'), ('SKR16000G27','SAA14001A10C006LRCDJ'), ('SKR12000E66','SAA14001A10C006LRCDJ'), ('SKR16000E66','SAA14001A10C006LRCDJ'), ('SKR12000A56','SAA14001A10C006LRCDJ'), ('SKR16000A56','SAA14001A10C006LRCDJ'), ('SKS12000G27','SAA14001A10C006LRCDJ'), ('SKS16000G27','SAA14001A10C006LRCDJ'), ('SKS12000E66','SAA14001A10C006LRCDJ'), ('SKS16000E66','SAA14001A10C006LRCDJ'), ('SKS12000A56','SAA14001A10C006LRCDJ'), ('SKS16000A56','SAA14001A10C006LRCDJ'), ('WBP16000P82','SAA14001A10C006LRCDJ') ) x("target","clone") ) ,istka AS ( SELECT repl.target v6part ,v6plnt ,v6unti ,v6rpln ,v6tpln ,v6tdys ,v6mrps ,v6abcc ,v6ccpy ,v6lcdt ,v6dbcc ,v6ordq ,v6opcy ,v6mult ,v6fut1 ,v6fut2 ,v6scdt ,v6plan ,v6cntr ,v6untp ,v6lvl ,v6pack ,v6pacu ,v6prpt ,v6kitc ,v6proc ,v6lrsp ,v6lrsc ,v6lrsf ,v6lrmp ,v6lrmc ,v6lrmf ,v6lwsp ,v6lwsc ,v6lwsf ,v6lcsp ,v6lcsc ,v6lcsf ,v6lcmp ,v6lcmc ,v6lcmf ,v6lssc ,v6lssf ,v6lsmp ,v6lsmc ,v6lsmf ,v6mpck ,v6mpku ,v6altf ,v6dbuy ,v6scdp ,v6selp ,v6rcps ,v6recu ,v6recc ,v6ftmf ,v6csmu ,v6ntky ,v6minq ,v6maxq ,v6moqt ,v6estv ,v6corg ,v6psor ,'C' v6stat ,v6reas ,v6auty ,v6unto ,v6reqc ,v6buyr ,v6lead ,v6optr ,v6multp ,v6minr ,v6perc ,v6ola ,v6mpqt ,v6dpst ,v6spdt ,v6bbdt ,v6orlt ,v6autr ,v6repp ,v6rept ,v6shrk ,v6fcfn ,v6auto ,v6olok ,v6oepy ,v6prfr ,v6cmtl ,v6drws ,v6drwl ,v6denc ,v6drel ,v6ddat ,v6drwn ,v6drws2 ,v6drwl2 ,v6denc2 ,v6drel2 ,v6ddat2 ,v6drwn2 ,v6lotf ,v6serf ,v6lotb ,v6lota ,v6lotv ,v6stcl ,v6vlcd ,v6sppp ,v6sppc ,v6mppp ,v6mppc ,v6frml ,v6istr ,v6engc ,v6revl ,v6rdat ,v6rcvlc ,v6sflc ,v6cusr ,v6cdat ,v6ctme ,v6uusr ,v6udat ,v6utme ,v6fut3 ,v6fut4 ,v6fut5 ,v6flg1 ,v6flg2 ,v6flg3 ,v6flg4 ,v6flg5 ,v6flg6 ,v6flg7 ,v6flg8 ,v6flg9 ,v6flg10 ,v6fut6 ,v6fut7 ,v6fut8 ,v6fut9 ,v6fut10 ,v6fut11 ,v6fut12 ,v6fut13 ,v6fut14 ,v6fut15 ,v6fut16 ,v6fut17 ,v6fut18 ,v6fut19 ,v6fut20 ,v6fut21 ,v6fut22 ,v6fut23 ,v6fut24 ,v6fut25 ,v6fut26 ,v6fut27 ,v6fut28 ,v6fut29 ,v6fut30 ,v6fut31 ,v6fut32 ,v6fut33 ,v6fut34 ,v6fut35 ,v6fut36 ,v6fut37 ,v6fut38 ,v6fut39 ,v6fut40 ,v6fut41 ,v6fut42 ,v6fut43 ,v6fut44 ,v6fut45 ,v6prcl ,v6dbac ,v6scdpt ,v6apsup ,v6matp ,v6matm ,v6mesc ,v6crtm ,v6lled ,v6pctr ,v6inqu ,v6clexp FROM repl INNER JOIN lgdat.stka ON v6part = repl.clone ) , istkmm AS ( SELECT repl.target avparta ,avdes1 ,avdes2 ,avdes3 ,avunti ,avmajg ,avming ,avmajs ,avmins ,avglcd ,avgled ,avharm ,avclss ,avfut3 ,avfut4 ,avfut5 ,avfutc ,avfutd ,avupcc ,avgtin ,avnwht ,avnwun ,avsvol ,avsvun ,avengc ,avrevl ,avrdat ,avcoil ,avfut9 ,avmspc ,avslif ,avdplt ,avuver ,avcata ,avfedc ,avtaxr ,avcust ,"avcpt#" ,"avrev#" ,avfut7 ,avfut8 ,avfutb ,avldat ,'C' avtype ,avfutk ,avfutn ,avppap ,avcusr ,avcdat ,avctme ,avuusr ,avudat ,avutme ,avsizc ,avstlc ,avcolc ,avassc ,avsasc ,avlcoil ,avgdfl ,avvdfl ,avwoqf ,avnmfc ,avfuth ,avfuti ,avfutl ,avfutm ,avfutp ,avfutq ,avfutr ,avprun ,avtotp ,avdisc ,avinvt ,avbk01 ,avbill ,avbk04 ,avbk06 ,avoldd ,avoldd2 ,avlotf ,avserf ,avorig ,avplan ,avminq ,avmaxq ,avlead ,avscdt ,avestv ,avcntr ,avuntp ,avlvl ,avmoqt ,avpack ,avpacu ,avprpt ,avkitc ,avproc ,avlrsp ,avlrsc ,avlrsf ,avlrmp ,avlrmc ,avlrmf ,avlwsp ,avlwsc ,avlwsf ,avlcsp ,avlcsc ,avlcsf ,avlcmp ,avlcmc ,avlcmf ,avlssc ,avlssf ,avlsmp ,avlsmc ,avlsmf ,avmpck ,avmpku ,avaltf ,avdbuy ,avfut1 ,avfut2 ,avfut6 ,avfuta ,avfutg ,avrecu ,avftmf ,avrecc ,avfutj ,avabcc ,avcorg ,avperc ,avoptr ,avmult ,avminr ,avshrk ,avstat ,avreas ,avspdt ,avbbdt ,avpsor ,avfuto ,avdrws ,avdrwl ,avdenc ,avdrel ,avddat ,avfute ,avdrws2 ,avdrwl2 ,avdenc2 ,avdrel2 ,avddat2 ,avfutf ,avstcl ,avvlcd ,avsppp ,avsppc ,avmppp ,avmppc ,avflg01 ,avflg02 ,avflg03 ,avflg04 ,avflg05 ,avflg06 ,avflg07 ,avflg08 ,avflg09 ,avflg10 ,avfut01 ,avfut02 ,avfut03 ,avfut04 ,avfut05 ,avfut06 ,avfut07 ,avfut08 ,avfut09 ,avfut10 ,avfut11 ,avfut12 ,avfut13 ,avfut14 ,avfut15 ,avfut16 ,avfut17 ,avfut18 ,avfut19 ,avfut20 ,avfut21 ,avfut22 ,avfut23 ,avfut24 ,avfut25 ,avfut26 ,avfut27 ,avfut28 ,avfut29 ,avfut30 ,avfut31 ,avfut32 ,avfut33 ,avfut34 ,avfut35 ,avfut36 ,avfut37 ,avfut38 ,avfut39 ,avfut40 ,avfut41 ,avfut42 ,avfut43 ,avfut44 ,avfut45 ,avudft ,avfrml ,avhaza ,avlled ,avdbac ,avscdpt ,avfifo ,avantid ,avsubt ,avprcl ,avotp ,avcbyl ,avsrvc ,avspal ,avpgrp FROM repl INNER JOIN lgdat.stkmm m ON m.avpart = repl.clone ) , istkmp AS ( SELECT repl.target awpart ,awdes1 ,awdes2 ,awdes3 ,awunti ,awmajg ,awming ,awmajs ,awmins ,awgldc ,awgled ,awharm ,awclss ,awfut3 ,awfut4 ,awfut5 ,awfutc ,awfutd ,awupcc ,awgtin ,awnwht ,awnwun ,awsvol ,awsvun ,'C' awtype ,awvend ,"awvpt#" ,"awrev#" ,awengc ,awrevl ,awrdat ,awfut7 ,awfut8 ,awfutb ,awcoil ,awfut9 ,awmspc ,awuver ,awcata ,awslif ,awfutk ,awfutn ,awppap ,awdplt ,awgdfl ,awvdfl ,awwoqf ,awlcoil ,awnmfc ,awsizc ,awstlc ,awcolc ,awassc ,awsasc ,awcusr ,awcdat ,awctme ,awuusr ,awudat ,awutme ,awfuth ,awfuti ,awfut6 ,awfutl ,awfutm ,awfuto ,awfutp ,awfutq ,awfutr ,awldat ,awlotf ,awserf ,awoldd ,awbk02 ,awoldd2 ,awdisc ,aworig ,awfedc ,awtaxr ,awbk01 ,awbk03 ,awbk04 ,awbk05 ,awinvt ,awconv ,awunto ,awreqc ,awoptr ,awlead ,awcorg ,awcntr ,awola ,awuntp ,awshrk ,awlvl ,awmoqt ,awpack ,awpacu ,awprpt ,awbuyr ,awauty ,awmpqt ,awabcc ,awstat ,awproc ,awlrsp ,awlrsc ,awlrsf ,awlrmp ,awlrmc ,awlrmf ,awlwsp ,awlwsc ,awlwsf ,awlcsp ,awlcsc ,awlcsf ,awlcmp ,awlcmc ,awlcmf ,awlssc ,awlssf ,awlsmp ,awlsmc ,awlsmf ,awmpck ,awmpku ,awfutj ,awfutg ,awdbuy ,awperc ,awreas ,awfut1 ,awfut2 ,awaltf ,awftmf ,awrecu ,awrecc ,awpsor ,awfuta ,awscdt ,awdrws ,awdrwl ,awdenc ,awdrel ,awddat ,awdrws2 ,awdrwl2 ,awdenc2 ,awdrel2 ,awddat2 ,awfute ,awfutf ,awstcl ,awvlcd ,awsppp ,awsppc ,awmppp ,awmppc ,awflg01 ,awflg02 ,awflg03 ,awflg04 ,awflg05 ,awflg06 ,awflg07 ,awflg08 ,awflg09 ,awflg10 ,awfut01 ,awfut02 ,awfut03 ,awfut04 ,awfut05 ,awfut06 ,awfut07 ,awfut08 ,awfut09 ,awfut10 ,awfut11 ,awfut12 ,awfut13 ,awfut14 ,awfut15 ,awfut16 ,awfut17 ,awfut18 ,awfut19 ,awfut20 ,awfut21 ,awfut22 ,awfut23 ,awfut24 ,awfut25 ,awfut26 ,awfut27 ,awfut28 ,awfut29 ,awfut30 ,awfut31 ,awfut32 ,awfut33 ,awfut34 ,awfut35 ,awfut36 ,awfut37 ,awfut38 ,awfut39 ,awfut40 ,awfut41 ,awfut42 ,awfut43 ,awfut44 ,awfut45 ,awudft ,awfrml ,awhaza ,awlled ,awdbac ,awscdpt ,awfifo ,awantid ,awsubt ,awprcl ,awotp ,awcbyl ,awsrvc ,awspal ,awpgrp FROM repl INNER JOIN lgdat.stkmp ON awpart = repl.clone ) , iicstm AS ( SELECT FROM istka INNER JOIN lgdat.icstm ON cgpart = v6part AND cgplnt = v6plnt )