Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Duplicate ids
Message
From
28/06/2001 08:34:38
Christian Cote
Les Logiciels Onoma Inc.
Longueuil, Quebec, Canada
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Client/server
Title:
Duplicate ids
Miscellaneous
Thread ID:
00524612
Message ID:
00524612
Views:
45
HI,
I need to update an Oracle table that has a duplicate id key but the subid (foreing key) is unique. I need to clean up the duplicate keys with something like SELECT MAX(id) FROM MyTable. After it, I was thinking that I could create a remote view like :

CREATE VIEW MyView REMOTE MyConnection AS ;
SELECT SubId, Id FROM MyTable WHERE Id IN ;
(SELECT Id FROM MyTable GROUP BY Id HAVING COUNT(*) > 1)

After making the view updatable, I would iterate into it and for each id:
- get the first Id
- Update the subsequent Id with the previous Max(Id) retreived by the select statement at the beginning of this message.
- Send the update to Oracle.

Is there a simpler way to achieve this ? Maybe it would be better to code in PL/SQL but I have the feeling that VFP will (again) make my life easier. I use VFP6 SP5 and Oracle 8.1.5.

Thank you for your help,
Christian Cote
Next
Reply
Map
View

Click here to load this message in the networking platform