Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

MySQL create function Times is wrong.

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

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$$

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report