update AllPunishment a set (a.CreditID)=(select b.CreditID from CorporationMainTable b where b.CorporationName=a.CorporationName and b.OrganizationCode=a.OrganizationCode and rownum =1) where exists (select 1 from CorporationMainTable b where b.CreditID=a.CreditID)