Forum Discussion

maahutch's avatar
maahutch
New Contributor
3 years ago

How to ignore duplicate rows when inserting record into table

In this Scenario, I have to insert data onto an Oracle DB. Before that one I’m performing a Left Outer join and separating the data (for Update and Insert) by using router. In Insert snap I have to insert all the data ,before that one Need to check whether the data is matching with Target table / not . If yes ignore those records if not then perform insert . This was the whole logic .
I have to take data columns from mapper and check the columns with oracle target table if data is already exists/not. But, Unfortunately It was troughing errors.

INSERT INTO Schema.tablename (DEST,FROM_D,INSRT_BY,INSRT_DT,LVL,TO_D,UPDT_DT) VALUES (‘“+$DEST+”’,‘“+$FROM_D+”’,‘“+$INSRT_BY+”’,‘“+$INSRT_DT+”’,‘“+$LVL+”’,‘“+$TO_D+”’,‘“+$UPDT_DT+”’) WHERE (DEST<>‘“+$DEST +”’ AND LVL<>‘“+$LVL +”’)

Where condition columns are Primary Keys to the table.
DEST,FROM_D,INSRT_BY,INSRT_DT,LVL,TO_D,UPDT_DT ---- Table columns
‘“+$DEST+”’,‘“+$FROM_D+”’,‘“+$INSRT_BY+”’,‘“+$INSRT_DT+”’,‘“+$LVL+”’,‘“+$TO_D+”’,‘“+$UPDT_DT+”’ ---- Mapper columns/Data

I think Experts will find a best solution for this issue.
@bojanvelevski @del @AleksandarAngelevski @Spiro_Taleski

Please help on this issue.