Declare cursor c is select distinct t.v_desc_attr_3 from fct_kri_def t, FCT_PLAN_RR_REPORT_MAP t1 where t.v_desc_attr_3 = t1.v_report_code -- and t.v_desc_attr_3 in ('FI19','OPRD','LEXP','LR') ; Begin for rec in c loop begin update fct_kri_def tt set tt.N_FREQUENCY_KEY = (select t.n_frequency_key from fsi_process_mon_plan t, FCT_PLAN_RR_REPORT_MAP t1 where t.n_plan_id = t1.n_plan_id and t1.v_report_code = rec.v_desc_attr_3) where tt.v_desc_attr_3 = rec.v_desc_attr_3; commit ; exception when others then rollback; end; end loop; end; /