Question

I have error in this code, not able to figure where am I going wrong:

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

Error is: #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 '' at line 4

Please help!

Was it helpful?

Solution

Have you specified an alternative DELIMITER, so MySQL knows your procedure does not end at the first semicolon it encounters (on line 4)?

DELIMITER ;; -- or anything you like

CREATE PROCEDURE ... ;;

DELIMITER ; -- back to normal again
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top