Skip to Content

Error handling in HANA stored proedure

Hi Expert,

We have a requirement where we need store the error records in a custom table with the entire records details.

For an example , I have a custom table with 15 rows out of them 5 are good records and 3 are bad records. I need to store this 3 bad records in another custom table .

We are using mass insert option the stored procedure . Is there any way to achieve this without using loop in store procedure?

Please suggest.

Thanks,

Girdhari

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • Feb 16, 2017 at 02:43 AM

    Hi Girdhari,

    Difficult to understand what exactly you want to do here. Please elaborate on what you meant by "mass insert option" and provide a shorter version of your SP along with data for the source table and target table.

    Regards,

    Lucas de Oliveira

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Srikanth,

      Thanks for reply.

      We can't split the data before inserting the data into physical data.

      I mean to say if the some records will not gets inserted in table due to some error , then those erroneous records needs to be gets updated in error log table.

      Thanks,

      Girdhari

  • Feb 16, 2017 at 09:19 PM

    Hi,

    That's still not clear Girdhari. The recommendation from Srikanth makes sense so please explain with details with you can't have intermediate result (for good and bad data) before inserting. So far I can't see why you'd need cursor here.

    Regards,

    Lucas de Oliveira

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Lukas,

      Let me try to explain you the scenario .Suppose calculation view has 100 records but while inserting in physical table , insert got failed due to some error in some records (Like duplicate entry,data type mismatch etc). As per below insert statement complete insert will get failed and none of of the records gets inserted in the table, correct me if I am wrong.

      insert into SAURAVSA.PRODUCT_NEW (Select * from "_SYS_BIC"."******.******.******/CV_PRODUCT")

      But our requirement is not to fail the complete insert , the records which do not have any error should get inserted in the physical table and the records which has error should get inserted in another error table. But as per my understanding this can be only done using Loop which is not recommenced. Is there any other way to do this without using Loop? Hope I am able to explain you the scenario .

      Thanks,

      Girdhari