Vasi04
asked on
DB trigger to delete duplicate rows
I want to write a DB trigger. I dont have any exp with oracle.
I have two tables - profile and product
The issue I have is that for each row in table profile, there are atleast 4 identical rows in table product. I want to clean up table product so that for each profile there is only one product profile.
HOw to do this?
I want to have a DB trigger to check everytime theres an insert on table product...that is to delete duplicate rows.
Thanks in advance
I have two tables - profile and product
The issue I have is that for each row in table profile, there are atleast 4 identical rows in table product. I want to clean up table product so that for each profile there is only one product profile.
HOw to do this?
I want to have a DB trigger to check everytime theres an insert on table product...that is to delete duplicate rows.
Thanks in advance
ASKER
I want to use trigger to avoid future insert of duplicate rows. Is this spossible?
With Single operation I can get rid of already existing duplicate rows.
With Single operation I can get rid of already existing duplicate rows.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
The best way to do this is to create a Primary key on the product profile. If the table already has a product profile, then create a unique index on product profile. This will ensure that duplicates do not occur.
Is there a reason you want to use a trigger ?