Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Duplicate ids
Message
De
28/06/2001 08:34:38
Christian Cote
Les Logiciels Onoma Inc.
Longueuil, Québec, Canada
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Titre:
Duplicate ids
Divers
Thread ID:
00524612
Message ID:
00524612
Vues:
46
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform