日期:2014-05-16  浏览次数:20654 次

跪求大神指导 ERROR 1064 (42000)
drop PROCEDURE if exists prc_track_week_delete;
create PROCEDURE prc_track_week_delete()
BEGIN
declare v_starttime datetime default now();
declare v_endtime datetime default now();
   
  
  declare exit handler for NOT FOUND begin end;
  declare exit handler for SQLEXCEPTION call prc_log(v_starttime,'prc_track_week_delete', 'error','');

TRUNCATE table g.ia_track_week;
commit;
END;
-------------------------------------
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 3
在mysql 版本为5.5.16上可以运行,在5.5.8上就运行出错,求指导

------解决方案--------------------
drop PROCEDURE if exists prc_track_week_delete;
DELIMITER //
create PROCEDURE prc_track_week_delete()
BEGIN
declare v_starttime datetime default now();
declare v_endtime datetime default now();

 
declare exit handler for NOT FOUND begin end;
declare exit handler for SQLEXCEPTION call prc_log(v_starttime,'prc_track_week_delete', 'error','');

TRUNCATE table g.ia_track_week;
commit;
END;
//
------解决方案--------------------
以为mysql会默认遇到;就表示结束 所以需要把默认的;改成//