help with multi-update

Posted on 16th Feb 2014 by admin

Now sure how to ask this really....
10g database if that matters.

I have a customer that accidently changed 742 records incorrectly. I'm being asked to fix it.

Here is the sql that SHOWS me the relevant columns...

Select
p2.numberprgn,
a.agreement_id,
p2.ng_legacy_agreement_id
from
msp_sc.probsummarym1 p, msp_sc.probsummarym2 p2, msp_sc.ngslaassistm1 a
where
p.NUMBERPRGN = p2.NUMBERPRGN and
a.ORG_LEVEL1 = p.NG_SECTOR_NM and
a.CURRENT_ASSIGN_GROUP = p.ASSIGNMENT and
a.SEVERITY = p.SEVERITY_CODE and
p.OPEN_TIME >= '1-AUG-09' AND
p.OPEN_TIME <= '21-OCT-09' and
P.CATEGORY = 'USER-DESKTOP' and
p2.ng_legacy_agreement_id = '379' and
p2.ng_legacy_agreement_id <> a.agreement_id;

When I ran a distinct query against the agreement id, I get a total of 7 id's.

361
352
356
358
350
348
360

So I need to change the legacy ids to match the respective agreement id.

I know how to do it on a one by one basis...but there has to be a better way than doing that 742 times.

example:
NUMBERPRGN AGREEMENT_ID NG_LEGACY_AGREEMENT_ID
IM2108605 356 379
IM2113059 356 379
IM2116625 356 379
IM2117250 356 379
IM2119411 356 379
How do I go about this?

thx

Other forums