update kenn_antr_aggr set stg=(select K.keybund from tmp_stg K where (kenn_antr_aggr.stg=K.schluessel or kenn_antr_aggr.stg='0' || K.schluessel))
where 1=(select count(*) from tmp_stg K where kenn_antr_aggr.stg=K.schluessel or kenn_antr_aggr.stg='0' || K.schluessel);
update kenn_lab_aggr_astat set stg=(select K.keybund from tmp_stg K where (kenn_lab_aggr_astat.stg=K.schluessel or kenn_lab_aggr_astat.stg='0' || K.schluessel))
where 1=(select count(*) from tmp_stg K where kenn_lab_aggr_astat.stg=K.schluessel or kenn_lab_aggr_astat.stg='0' || K.schluessel);
update kenn_sos_lab set stg=(select K.keybund from tmp_stg K where (kenn_sos_lab.stg=K.schluessel or kenn_sos_lab.stg='0' || K.schluessel))
where 1=(select count(*) from tmp_stg K where kenn_sos_lab.stg=K.schluessel or kenn_sos_lab.stg='0' || K.schluessel);
update kenn_sos_stg set stg=(select K.keybund from tmp_stg K where (kenn_sos_stg.stg=K.schluessel or kenn_sos_stg.stg='0' || K.schluessel))
where 1=(select count(*) from tmp_stg K where kenn_sos_stg.stg=K.schluessel or kenn_sos_stg.stg='0' || K.schluessel);
update kenn_stg_aggr set stg=(select K.keybund from tmp_stg K where (kenn_stg_aggr.stg=K.schluessel or kenn_stg_aggr.stg='0' || K.schluessel))
where 1=(select count(*) from tmp_stg K where kenn_stg_aggr.stg=K.schluessel or kenn_stg_aggr.stg='0' || K.schluessel);
update kenn_stg_aggr_astat set stg=(select K.keybund from tmp_stg K where (kenn_stg_aggr_astat.stg=K.schluessel or kenn_stg_aggr_astat.stg='0' || K.schluessel))
where 1=(select count(*) from tmp_stg K where kenn_stg_aggr_astat.stg=K.schluessel or kenn_stg_aggr_astat.stg='0' || K.schluessel);
update kenn_stg_int set astat=(select K.keybund from tmp_stg K where (kenn_stg_int.astat=K.schluessel or kenn_stg_int.astat='0' || K.schluessel))
where 1=(select count(*) from tmp_stg K where kenn_stg_int.astat=K.schluessel or kenn_stg_int.astat='0' || K.schluessel);
update kenn_antr_aggr set stg='0' || stg where length(trim(stg))=3;
update kenn_lab_aggr_astat set stg='0' || stg where length(trim(stg))=3;
update kenn_sos_lab set stg='0' || stg where length(trim(stg))=3;
update kenn_sos_stg set stg='0' || stg where length(trim(stg))=3;
update kenn_stg_aggr set stg='0' || stg where length(trim(stg))=3;
update kenn_stg_aggr_astat set stg='0' || stg where length(trim(stg))=3;
update kenn_stg_int set astat='0' || astat where length(trim(astat))=3;