What is wrong with this create function? I can not figure it out. Already the error in the first line.
CREATE FUNCTION SEQ_NEXT_VAL()
RETURNS INT
DETERMINISTIC
BEGIN
DECLARE retorno INT;
SELECT MAX(IDE_ERROR) INTO retorno FROM ERROR_LOGGING;
IF retorno = NULL THEN
retorno = 1;
ELSE
retorno = retorno + 1;
END IF;
RETURN retorno;
END;