Quantcast
Channel: SCN: Message List - SAP HANA and In-Memory Computing
Viewing all articles
Browse latest Browse all 8968

Re: Raising custom error message in HANA Stored procedure

$
0
0

Ok, first of all: if you already made this experiment, you could have improved the chances to get a more fitting reply by telling that you did.

Other than that, you don't define an exit handler for the standard error code 301 and you don't signal your own error message then.

 

CREATE PROCEDURE MYPROC1 AS

BEGIN

    DECLARE MYCOND CONDITION FOR SQL_ERROR_CODE 301;

    DECLARE EXIT HANDLER FOR MYCOND SELECT ::SQL_ERROR_CODE, 'my error' FROM DUMMY;

    INSERT INTO MYTAB VALUES (1);

    -- will not be reached

END;

CALL MYPROC1;

 

:1  'my error'

301 my error 

 

That does the trick here.

 

 

- Lars


Viewing all articles
Browse latest Browse all 8968

Trending Articles



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