Skip to Content
avatar image
-1
Former Member

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

Hi,

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.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

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

    Hi,

    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.

    Regards,
    Mateusz.

    Add comment
    10|10000 characters needed characters exceeded