1327-Undeclared variable:amount

1、错误描述

2、错误原因

BEGIN
	SELECT 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、解决办法

BEGIN
	SELECT 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
时间: 2024-09-27 01:01:27

1327-Undeclared variable:amount的相关文章

错误代码: 1327 Undeclared variable: p_film_count

1.错误描写叙述 1 queries executed, 0 success, 1 errors, 0 warnings 查询:SELECT FOUND_ROWS() INTO p_film_count 错误代码: 1327 Undeclared variable: p_film_count 运行耗时 : 0 sec 传送时间 : 0 sec 总耗时 : 0 sec 2.错误原因 SELECT FOUND_ROWS() INTO p_film_count; 因为这个p_film_count是存储

Mysql中select into from用法

原文:http://www.111cn.net/database/mysql/60705.htm 在mysql中用select into from一直报错, 错误:#1327 - Undeclared variable: target_test select into from要求目标表target_table不存在,因为在插入时会自动创建 后来在网上看资料说Mysql不支持select into from语句,所以用其他方法来替代select into from语句: Create targe

mysql触发器语法的一个实例

我要实现的功能是:在更新一个表时.从三个表中查询记录并插入到另外一个表中.以下是我写触发器的过程: 第一次写的触发器例如以下: CREATE TRIGGER istmingxi AFTER UPDATE ON sys_shenbao FOR EACH ROW BEGIN SELECT @kid:=jl.kid,@gonghao:=shen.gonghao,@vuid:=jl.vuid,@zhibiao:=ct.leibie, @citiao:=ct.bianhao,@fenshu:=ct.fen

My ECMAScript 7 wishlist

With ECMAScript 6 now feature complete, any further changes to the core of JavaScript will happen in ECMAScript 7. I’m pretty excited about the changes coming in ECMAScript 6 and there are already some great ECMAScript 7 features such as Object.obser

mysql下的SELECT INTO语句

在mysql下使用SELECT INTO语句会产生ERROR 1327 (42000): Undeclared variable:new_tablename 此时要使用: CREATE TABLE CYRTEMP(SELECT Cno,COUNT(Sno),AVG(Score) FROM CYRReports GROUP BY(Cno)); 来替代原句: SELECT Cno,COUNT(Sno),AVG(Score) INTO SUM_AVGSco FROM CYRReports GROUP

跨平台的CStdString类,实现了CString的接口

在实际工作中,std的string功能相对于MFC的CString来说,实在是相形见绌. CStdString类实现了CString的功能,支持跨平台. 1 // ============================================================================= 2 // FILE: StdString.h 3 // AUTHOR: Joe O'Leary (with outside help noted in comments) 4 //

MYSQL之错误代码----mysql错误代码与JAVA实现

原文地址:MYSQL之错误代码----mysql错误代码与JAVA实现作者:戒定慧 his chapter lists the errors that may appear when you call MySQL from any host language. The first list displays server error messages. The second list displays client program messages. Server error informati

MySQL数据库应用(9)DQL之select知识

一.查看数据 1.查询表的所有数据行 1)命令语法:select <字段1,字段2,...> from <表名> where <表达式> 其中,select,from,where 是不能随便改的,是关键字,支持大小写 2)例:查看表test中所有数据 a.进入指定库后查询 mysql> use oldboy Database changed mysql> select * from test; +----+---------+ | id | name | +

xcode工程编译错误:error: Couldn’t materialize

错误信息: error: Couldn't materialize: couldn't get the value of variable amount: variable not available error: errored out in DoExecute, couldn't PrepareToExecuteJITExpression. 解决:Release改为Debug