1327-Undeclared variable:amount

来源:互联网 发布:索尼传输软件 编辑:程序博客网 时间:2024/05/10 13:48

1、错误描述



2、错误原因

BEGINSELECT stuAge INTO amount;  IF stuAge IS NOT NULL THEN  SET stuAge = stuAge + 1;  SELECT stuAge INTO amount1;  ELSE  SELECT 20 INTO amount2;  END IF;  SELECT stuAge INTO amount3;END;

   amount实际是stuAge的别名,但是却写成了一个变量


3、解决办法

BEGINSELECT stuAge AS amount;  IF stuAge IS NOT NULL THEN  SET stuAge = stuAge + 1;  SELECT stuAge AS amount1;  ELSE  SELECT 20 INTO stuAge;  END IF;  SELECT stuAge AS amount3;END


1 0
原创粉丝点击