0

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!

7HUND3RX
  • 175
  • 3
  • 14
  • Can't (yet) spot the source of your error, but as an aside why don't you use [`REPLACE`](http://dev.mysql.com/doc/refman/5.6/en/replace.html) or [`INSERT ... ON DUPLICATE KEY UPDATE`](http://dev.mysql.com/doc/refman/5.6/en/insert-on-duplicate.html)? – eggyal Apr 24 '12 at 06:35

1 Answers1

0

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
eggyal
  • 122,705
  • 18
  • 212
  • 237