update t_table a set a.flag ='1' ,dealflag = '0'
where exists (select *
from t_table2 bwhere nvl(b.status,'X') = 'C'
and a.company = b.company
and substr(a.no, 4) = b.flag_no || '001'
and a.date=
trunc(b.date)
and a.col1= b.col1
and a.col2= b.col2)
and a.years = '2016'
and a.months = '12'