Skip to Content

Hana Insert Into Select fails on duplicate records; duplicate should be skipped and others inserted.

Apr 17, 2017 at 07:19 PM


avatar image
Former Member


I need your help to get a solution/workaround for insert into select.

I have a cv having bulk of data.

I have to insert that data into a target table on daily basis.

for that Stored procedure is written.

and daily we are inserting using insert into select statement.

But if any record is already available in target table then unique constraint occurs.

Insert into target_table (column1,column2,column3,column4)

select column1,column2,column3,column4 from CV;

Declare exit handler is only captures the error and then comes out of the procedure.

I want to save error record in separate table and stored procedure should skip error record and continue inserting next records.

Kindly help me to implement this requirement.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

avatar image
Former Member Apr 18, 2017 at 09:56 AM


try to aggregate them (count), create a dummy column if needed.

Insert the aggregated data to your table (without dummy).
Store the records if their count number is greater than 1.


10 |10000 characters needed characters left characters exceeded