BEGIN
FOR cur IN (
SELECT b.dm,b.mc FROM xxx b
) loop
UPDATE xxx s SET s.dm= cur.dm where s.mc is not null and s.dm is null and cur.mc= s.mc
END loop;
END;
BEGIN
FOR L_RECORD IN (
SELECT a.* FROM GBT_BATTERYTRACE_WR a WHERE a."modulecode" IN ( SELECT DISTINCT
MODULECODE FROM GBT_BATTERYTRACE )
)
LOOP
UPDATE GBT_BATTERYTRACE x SET x.PACKCODE = L_RECORD."packcode"
WHERE x.MODULECODE = L_RECORD."modulecode";

END LOOP;
END;