读书人

创建存储过程出错 Undeclared variabl

发布时间: 2012-04-14 17:14:21 作者: rapoo

创建存储过程出错 Undeclared variable:t
这是我的存储过程:

SQL code
drop procedure if exists select_app;delimiter //create procedure select_app(in timei varchar(50),out tappid varchar(10),out tappsecret varchar(50))    begin                DECLARE start varchar(50) ;        DECLARE iend varchar(50);        DECLARE ttype int;        select t.startimei into start ,t.endimei into iend, t.type into ttype from t_imei_typeinfo as t , t_imei_entityinfo as e where e.imei = timei and e.type = t.type;        if (timei > start && timei < tend)            select appid,appsecret from t_disktypeinfo where type = ttype;        end if;    end//delimiter ;


创建的时候报Undeclared variable:t 这个语法有问题吗?

[解决办法]
select t.startimei ,t.endimei, t.type into startinto , , ttype from t_imei_typeinfo as t , t_imei_entityinfo as e where e.imei = timei and e.type = t.type;

[解决办法]
DROP PROCEDURE IF EXISTS select_app;
DELIMITER //

CREATE PROCEDURE select_app(IN timei VARCHAR(50),OUT tappid VARCHAR(10),OUT tappsecret VARCHAR(50))
BEGIN
DECLARE `start` VARCHAR(50) ;
DECLARE iend VARCHAR(50);
DECLARE ttype INT;

SELECT startimei ,endimei , `TYPE` INTO `start` ,iend , ttype FROM t_imei_typeinfo AS t , t_imei_entityinfo AS e WHERE e.imei = timei AND e.type = t.type;

IF (timei > `start` AND timei < tend) THEN
SELECT appid,appsecret FROM t_disktypeinfo WHERE `type` = ttype;
END IF;

END//

DELIMITER ;

读书人网 >Mysql

热点推荐