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

求救:MYsql创建存储过程时报错1064
执行的SQL语句是:
create procedure TJZGS as select N_RYBH,sum(TIMEDIFF(D_XBSJ,D_SBSJ)) from T_RY_KQXX;

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 'as select N_RYBH,sum(TIMEDIFF(D_XBSJ,D_SBSJ)) from T_RY_KQXX' at line 1

------解决方案--------------------
参考一下MYSQL官方免费帮助中的例子。 没有 create procedure ... as .. 这种语法。
------解决方案--------------------
SQL code
create procedure TJZGS 
begin
 select N_RYBH,sum(TIMEDIFF(D_XBSJ,D_SBSJ)) from T_RY_KQXX
end;

------解决方案--------------------
delimiter $$
create procedure TJZGS()
begin
select N_RYBH,sum(TIMEDIFF(D_XBSJ,D_SBSJ)) from T_RY_KQXX;
end;
delimiter ;