Error 1313: RETURN is only allowed in a FUNCTION SQL Statement

1、错误描述

14:07:26	Apply changes to rand_string	Error 1313: RETURN is only allowed in a FUNCTION SQL Statement:  CREATE PROCEDURE `rand_string` (n int)  BEGIN   DECLARE chars varchar(100) DEFAULT 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';                 DECLARE return_str varchar(255) DEFAULT '';                 DECLARE i INT DEFAULT 0;                 WHILE i < n DO                                 SET return_str = concat(return_str,substring(chars , FLOOR(1 + RAND()*52 ),1));                           SET i = i +1;                 END WHILE;                 RETURN return_str; END   

2、错误原因

由上述可知,RETURN仅仅只能在函数SQL语句里用

3、解决办法

修改存储过程,去掉RETURN值

上一篇:mvc5+ef6+Bootstrap 项目心得--身份验证和权限管理


下一篇:教你如何在Android 6.0上创建系统悬浮窗