Skip to Content
0
Jan 13, 2023 at 03:58 AM

Bulk INSERT - How to Skip error records in CAPM service

235 Views

Hello Experts,

We have a scenario where the batch job reads data from an external system and inserts into our HANA Cloud DB. The bulk insert is working fine but when any error occurs in inserting any of the records, the entire batch is getting failed. We were looking for options to skip the error record and continue with remaining.

In normal SQL, there seems to be options like IGNORE, MAXERRORS etc parameters. But couldn't figure out how we can specify them with the CQL or is there any better approach to handle these error records.

Please suggest possible alternatives or correct approach.

try { var result = await cds.run(INSERT.into('IntDBStatusMsgs', hanaData)); console.log('Inserting no of records: ' + result?.results?.length); return `Data uploaded successfully.`
} catch (error) { console.log(`Error occurred during insertion of data: ${error.message} \n ${error.query} \n ${error.stack}` ); }

Thanks in advance!

Regards,

Bhavyasri M