CREATE PROCEDURE错误

时间:2012-04-24 06:28:10

标签: mysql stored-procedures procedures

我在此代码中有错误,无法确定我哪里出错:

CREATE DEFINER=`condoleu`@`%` PROCEDURE `sp_user_field_content_mgt`(FieldContentId varchar(50), FieldRef varchar(50),UserRefId varchar(50), description text,photoUpload varchar(50), photoText varchar(50), MusicText varchar(50), MusicUpload varchar(50), VideoText varchar(50), VideoUpload varchar(50), DispText enum('Y','N'), Flag int(1))
BEGIN
IF Flag=0 THEN
INSERT INTO tbl_contribution_master(field_content_id,field_ref_id,user_ref_id,description,uploaded_photo,photo_text,uploaded_music,music_text,uploaded_video,video_text,disp_text)     VALUES(FieldContentId,FieldRef,UserRefId,description,photoUpload,photoText,MusicUpload,MusicText,VideoUpload,VideoText,DispText);
ELSE
UPDATE tbl_contribution_master SET
description = description,
uploaded_photo = photoUpload,
photo_text = photoText,
uploaded_music = MusicUpload,
music_text = MusicText,
uploaded_video = VideoUpload,
video_text = VideoText,
disp_text = DispText
WHERE field_content_id = FieldContentId;
END IF;
END

错误是:#1064 - 您的SQL语法出错;检查与MySQL服务器版本对应的手册,以便在第4行的''附近使用正确的语法

请帮忙!

1 个答案:

答案 0 :(得分:0)

你有specified an alternative DELIMITER,所以MySQL知道你的程序没有在它遇到的第一个分号结束时(在第4行)?

DELIMITER ;; -- or anything you like

CREATE PROCEDURE ... ;;

DELIMITER ; -- back to normal again