Quantcast
Channel: SCN : Discussion List - SAP HANA Developer Center
Viewing all articles
Browse latest Browse all 6412

Error handler for any error type

$
0
0

Hi all,

 

how can I implement an error handler within a SQLScript procedure that is called for any error type?

 

We defined the handler as follows

 

 

  DECLARE EXIT HANDLER FOR SQLEXCEPTION

  BEGIN

  CALL "XY"."XY.sql.proc.utils::LOG_ERROR" (P_SESSION, 'CALC_MAIN', ::SQL_ERROR_MESSAGE);

  CALL "XY"."XY.sql.proc.utils::LOG_ERROR" (P_SESSION, 'CALC_MAIN', 'Calculation Failed');

  [...]

  END;

 

It works nicely for various errors as e.g. unique key constraint violation for table insert.

 

 

However for at least one type of error this handler is not called: If for some reasons a join would result in a very very large number of lines (multiple billions of lines), the following error is thrown (not calling the error handler above):

 

 

  Could not execute 'call "XY"."XY.sql.proc.calc::CALC_MAIN" (1,?,?)' in 3:44.821 minutes .

  SAP DBTech JDBC: [2048]: column store error:  [2048] "XY"."XY.sql.proc.calc::CALC_MAIN": line 137 col 2 (at pos 7697): [2048] (range 3) .

 

 

I tried to implement a specific error handler for this error (2048):

 

 

  DECLARE EXIT HANDLER FOR SQL_ERROR_CODE 2048

  BEGIN

  CALL "XY"."XY.sql.proc.utils::LOG_ERROR" (P_SESSION, 'CALC_MAIN', ::SQL_ERROR_MESSAGE);

  CALL "XY"."XY.sql.proc.utils::LOG_ERROR" (P_SESSION, 'CALC_MAIN', 'Calculation Failed');

  [...]

  END;

 

 

However, it's not possible to activate it:

 

  XY.sql.proc.calc:CALC_MAIN.hdbprocedure

Could not create catalog object: feature not supported; The error code is not allowed in handler

 

 

How can I create an error handler for any error types?

 

 

Thanks!

Markus


Viewing all articles
Browse latest Browse all 6412

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>