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
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement