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