Get the App
SLTechnology News&Howtos  ›  Database  › 

MySQL create function Times is wrong.

Shulou Source: shulou.com Published: 2022-06-01 04:57:28 11月06日 Update

MySQL create function Times is wrong.

Mysql > delimiter $$

Mysql > CREATE FUNCTION is_ChangeDescColumnExist (THE_VERSION_LEVEL_TABLE_NAME VARCHAR (35)) RETURN INT DETERMINISTIC

-> BEGIN

-> DECLARE nbr INT

-> SET nbr = 0

-> / * DECLARE CONTINUE HANDLER FOR NOT FOUND RETURN 0 investors /

-> select count (*) into nbr from information_schema.columns where table_name = THE_VERSION_LEVEL_TABLE_NAME and

-> (column_name = 'ClearCHANGEN description')

-> IF nbr = 1 THEN

-> RETURN 1

-> ELSE

ELSE ELSEIF

-> ELSE

-> RETURN 0

-> END IF

-> END$$

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'RETURN INT DETERMINISTIC

BEGIN

DECLARE nbr INT

SET nbr = 0

Sel' at line 1

Reason for reporting an error:

The return keyword in the RETURN INT DETERMINISTIC statement should be RETURNS

After modification, the creation function is normal.

Delimiter $$

CREATE FUNCTION is_ChangeDescColumnExist (THE_VERSION_LEVEL_TABLE_NAME VARCHAR (35)) RETURNS INT DETERMINISTIC

BEGIN

DECLARE nbr INT

SET nbr = 0

/ * DECLARE CONTINUE HANDLER FOR NOT FOUND RETURN 0 ownership /

Select count (*) into nbr from information_schema.columns where table_name = THE_VERSION_LEVEL_TABLE_NAME and

(column_name = 'ClearCHANGEN description')

IF nbr = 1 THEN

RETURN 1

ELSE

RETURN 0

END IF

END$$

Tags: Times keys keywords functions reasons sentences Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker Apple Shulou Tech Info vpn Huawei