Hi,
I am writing a procedure to recreate a SQLSERVER function ISNUMERIC in HANA SP4 as:
CREATE PROCEDURE ISNUMERIC_ALEX (
IN N VARCHAR(255),
out L_RETURN VARCHAR(1)
) LANGUAGE SQLSCRIPT AS
/* Returns 'T' if the value is NUMERIC 'F' otherwise */
l_temp float;
L_RETURN VARCHAR2(1) := 'T';
BEGIN
DECLARE MYCOND CONDITION FOR SQL_ERROR_CODE 592;
DECLARE EXIT HANDLER FOR MYCOND L_RETURN := 'F';
SELECT to_integer(:N), 'T' INTO l_temp, L_RETURN FROM DUMMY;
END;
I am getting an error on compilation:
Could not execute 'CREATE PROCEDURE ISNUMERIC_ALEX"( IN N VARCHAR(255), out L_RETURN VARCHAR(1) ) ...'
SAP DBTech JDBC: [7]: feature not supported: The error code is not allowed in handler.
In the SP4 Manual there is an example for a trigger:
CREATE TRIGGER MYTRIG_CONDITION
AFTER DELETE ON TARGET
BEGIN
DECLARE MYCOND CONDITION FOR SQL_ERROR_CODE 301;
DECLARE EXIT HANDLER FOR MYCOND SELECT ::SQL_ERROR_CODE, ::SQL_ERROR_MESSAGE FROM DUMMY;
INSERT INTO MYTAB VALUES (1);
INSERT INTO MYTAB VALUES (1); -- expected unique violation error: 301
-- not reached
END;
What am I doing wrong?
Thanks,
Alex Vaynberg