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

mysql创建存储过程出错!急!
delimiter //
drop procedure if exists insertSmessage;
create procedure insertSmessage(bCret bool,eNumber varchar(20),startId varchar(30),saveId varchar(30),starUser varchar(10),joinUser text,startTime char(19),endTime char(19),smessage text,sessionType int)
begin
DECLARE sId int default 1;
if bCret is true then
insert into SessionInfo values(eNumber,startId,starUser,joinUser,startTime,endTime,sessionType);
end if;
selsec id into sId from SessionInfo where staffId = startId;
insert into MessageInfo values(eNumber,startId,saveId,startTime,smessage,sId);
end;
//
delimiter ;
我的是mysql5.5,navicat8。保存时提示:1064 - 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 '//drop procedure if exists insertSmessage;create procedure insertSmessage(bC' at line 2

------解决方案--------------------
delimiter //
drop procedure if exists insertSmessage//
create procedure insertSmessage(bCret bool,eNumber varchar(20),startId varchar(30),saveId varchar(30),starUser varchar(10),joinUser text,startTime char(19),endTime char(19),smessage text,sessionType int)
begin
DECLARE sId int default 1;
if bCret is true then
insert into SessionInfo values(eNumber,startId,starUser,joinUser,startTime,endTime,sessionType);
end if;
selsec id into sId from SessionInfo where staffId = startId;
insert into MessageInfo values(eNumber,startId,saveId,startTime,smessage,sId);
end;
//
delimiter ;