```SQL drop table uic.tmp_ac_master; create table uic.tmp_ac_master as select ac_reg_no, ac_ty_icao, ac_ty_iata, ac_grad, ARLN_CD_IATA, arln_cd_icao from ( select a.ac_reg_no , nvl((select UCM.fun_get_cmmn_ref('CT063', a.ac_ty_iata, 1) from dual), a.ac_ty_icao) as ac_ty_icao , a.ac_ty_iata , a.ac_grad , b.ARLN_CD_IATA , (select uic.fun_arln_Iata2Icao(b.ARLN_CD_IATA) from dual ) as arln_cd_icao from uic.V_FLT_ARR_ALL a, uic.SACP_FLT_SCHDUL b where a.arr_no = b.SCHDUL_NO and a.ac_ty_icao is not null and a.ac_ty_iata is not null and a.ac_reg_no is not null and b.FLT_SE = 'A' union all select a.ac_reg_no , nvl((select UCM.fun_get_cmmn_ref('CT063', a.ac_ty_iata, 1) from dual), a.ac_ty_icao) as ac_ty_icao , a.ac_ty_iata , a.ac_grad , b.ARLN_CD_IATA , (select uic.fun_arln_Iata2Icao(b.ARLN_CD_IATA) from dual ) as arln_cd_icao from uic.V_FLT_DEP_ALL a, uic.SACP_FLT_SCHDUL b where a.dep_no = b.SCHDUL_NO and a.ac_ty_icao is not null and a.ac_ty_iata is not null and a.ac_reg_no is not null and b.FLT_SE = 'D' ) group by ac_reg_no, ac_ty_icao, ac_ty_iata, ac_grad, ARLN_CD_IATA, arln_cd_icao drop table uic.tmp_reg_ex_list; create table uic.tmp_reg_ex_list as select ac_reg_no from uic.tmp_ac_master group by ac_reg_no having count(ac_reg_no) > 1 select * from ucm.SACP_AC_MASTER a, uic.tmp_ac_master b where a.AC_REG_NO = b.ac_reg_no and a.ac_reg_no not in ( select ac_reg_no from uic.tmp_reg_ex_list ) select * from uic.tmp_ac_master update ucm.SACP_AC_MASTER a set (ac_ty_icao, a.ac_ty_iata, ac_grad, arln_cd_iata, arln_cd_icao) = (select c.ac_ty_icao, c.ac_ty_iata, c.ac_grad, c.arln_cd_iata, c.arln_cd_icao from uic.tmp_ac_master c where a.ac_reg_no = c.ac_reg_no and c.ac_reg_no not in ( select ac_reg_no from uic.tmp_reg_ex_list ) ) where ac_reg_no in ( select ac_reg_no from uic.tmp_ac_master ) select * from ucm.SACP_AC_MASTER ```