我从PHPstudy的MYSQL5.3导出sql文,在LINUX下5MYSQL5.54版本执行,存储过程不能执行,但是在windows下就好用,本人是小白不太懂什么存储过程,请哪位大神指点。
这个是存储过程SQL文
DROP PROCEDURE IF EXISTS `deleteDingdan`;
CREATE PROCEDURE `deleteDingdan`(in deleID int)
BEGIN DELETE FROM wkcx_dingdan WHERE id<deleID AND dayinflag=3; END;
DROP PROCEDURE IF EXISTS `deleteDingdan3`;
CREATE PROCEDURE `deleteDingdan3`()
BEGIN DELETE FROM wkcx_dingdan WHERE printed_time<curdate() AND dayinflag=3; END;
DROP PROCEDURE IF EXISTS `savehistoryDingdan`;
CREATE PROCEDURE `savehistoryDingdan`()
BEGIN declare countlines int default 0;  declare movelines int default 0;  declare moveID int default 0; declare exit handler for sqlexception rollback; START transaction; SELECT COUNT(*) INTO countlines FROM wkcx_dingdan; SELECT historyID INTO moveID FROM dingdan_history WHERE dayinflag=1 ORDER BY historyID ASC limit 1; IF moveID=0 THEN SELECT MAX(historyID) INTO moveID FROM dingdan_history;END IF; IF countlines>0 THEN  INSERT INTO dingdan_history (historyID,add_time,printed_time,dingdanID,dayinflag,dayinjisn,pages,replyURL,clientURL,dingdan) SELECT id,add_time,printed_time,dingdanID,dayinflag,dayinjisn,pages,replyURL,clientURL,dingdan FROM wkcx_dingdan ON DUPLICATE KEY UPDATE dingdan_history.printed_time = wkcx_dingdan.printed_time,dingdan_history.dayinflag = wkcx_dingdan.dayinflag; SET movelines=1; END IF; commit; IF movelines=1 THEN CALL deleteDingdan(moveID); END IF; commit; END;
DROP PROCEDURE IF EXISTS `updateSNPro`;
CREATE PROCEDURE `updateSNPro`(IN snVar VARCHAR(12),IN mCc0int int, IN mCc1int int)
BEGIN DECLARE sncount int default -1; SELECT COUNT(*) INTO sncount FROM printer WHERE dsn=snVar; IF sncount>0 THEN UPDATE printer SET difT
这个是错误信息
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 '' at line 2
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 'END' at line 1
Query OK, 0 rows affected, 1 warning (0.00 sec)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 '' at line 2
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 'END' at line 1
Query OK, 0 rows affected, 1 warning (0.00 sec)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 '' at line 2
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 'declare movelines int default 0' at line 1
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 'declare moveID int default 0' at line 1
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 'declare exit handler for sqlexception rollback' at line 1
Query OK, 0 rows affected (0.00 sec)ERROR 1327 (42000): Undeclared variable: countlines
ERROR 1327 (42000): Undeclared variable: moveID
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 'IF moveID=0 THEN SELECT MAX(historyID) INTO moveID FROM dingdan_history' at line 1
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 'END IF' at line 1
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 'IF countlines>0 THEN  INSERT INTO dingdan_history (historyID,add_time,printed_ti' at line 1
ERROR 1193 (HY000): Unknown system variable 'movelines'
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 'END IF' at line 1
Query OK, 0 rows affected (0.00 sec)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 'IF movelines=1 THEN CALL deleteDingdan(moveID)' at line 1
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 'END IF' at line 1
Query OK, 0 rows affected (0.00 sec)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 'END' at line 1
Query OK, 0 rows affected, 1 warning (0.00 sec)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 '' at line 2
ERROR 1327 (42000): Undeclared variable: sncount
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 'IF sncount>0 THEN UPDATE printer SET difTime=UNIX_TIMESTAMP(now())-UNIX_TIMESTAM' at line 1
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 'ELSE INSERT INTO printer (id,dsn,online_date,error0,error1) VALUES ('0',snVar,no' at line 1
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 'END IF' at line 1
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 'END' at line 1