Mysql Error 1064 Create Procedure
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us mysql create stored procedure Learn more about Stack Overflow the company Business Learn more about hiring developers
Error 1064 42000
or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up syntax error : 1064 , when creating a stored procedure up vote 1 down vote favorite CREATE table parent_user ( userid int auto_increment PRIMARY KEY, Username varchar(100) NOT NULL, Password varchar(200) NOT NULL, Email varchar(200) NOT NULL ); EDIT : OK so I made some changes: CREATE PROCEDURE `parent_reg` ( pUserName varchar(100) pPassword varchar(200) pEmail varchar(200) ) as Begin Declare Count int Declare ReturnCode int Select Count = Count(Username) from parent_user where Username = @Username If Count > 0 Begin Set ReturnCode = -1 End Else Begin Set ReturnCode = 1 insert into parent_user values (pUserName, pPassword, pEmail) End Select pReturnCode as ReturnValue End But I still got the same error- Error 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 'pPassword varchar(200) pEmail varchar(200) ) ....' The syntax error is at 'pPassword varchar(200)' mysql database stored-procedures syntax share|improve this question edited Jan 24 at 23:30 asked Jan 24 at 22:54 Sonia Mathews 206 I think it's because of the word "stored", you don't need it. You just need CREATE PROCEDURE –Phiter Fernandes Jan 24 at 22:59 Also there is a select with a comma in the line above the create procedure which idk what is doing there –Phiter Fernandes Jan 24 at 23:00 First, your syntax looks like a strange mixture of SQL Server and MySQL. Second, what is select * from parent_user, doing there? –Gordon Linoff Jan 24 at 23:02 add a comment| 2 Answers 2 active oldest votes up vote 0 down vote accepted This i
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up SQL syntax error when creating a stored procedure in MYSQL up vote 5 down vote favorite 1 i http://stackoverflow.com/questions/34982577/syntax-error-1064-when-creating-a-stored-procedure have a hard time locating an error when trying to create a stored procedure in mysql. if i run every single line of the procedure independently, everything works just fine. CREATE PROCEDURE cms_proc_add_child (param_parent_id INT, param_name CHAR(255), param_content_type CHAR(255)) BEGIN SELECT @child_left := rgt FROM cms_tree WHERE id = param_parent_id; UPDATE cms_tree SET rgt = rgt+2 WHERE rgt >= @child_left; UPDATE cms_tree SET lft = lft+2 WHERE lft >= @child_left; INSERT INTO cms_tree http://stackoverflow.com/questions/639089/sql-syntax-error-when-creating-a-stored-procedure-in-mysql (name, lft, rgt, content_type) VALUES (param_name, @child_left, @child_left+1, param_content_type); END i get the following (helpful) error: 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 '' at line 3 … i just don't know where to start debugging, as every single one of these lines is correct. any tips? mysql stored-procedures share|improve this question asked Mar 12 '09 at 15:14 Pierre Spring 4,05593642 add a comment| 3 Answers 3 active oldest votes up vote 17 down vote accepted As line 3 contains the first ; perhaps you have a problem with your delimiters. see http://dev.mysql.com/doc/refman/5.0/en/stored-programs-defining.html mysql> delimiter // mysql> CREATE PROCEDURE dorepeat(p1 INT) -> BEGIN -> SET @x = 0; -> REPEAT SET @x = @x + 1; UNTIL @x > p1 END REPEAT; -> END -> // Query OK, 0 rows affected (0.00 sec) mysql> delimiter ; share|improve this answer answered Mar 12 '09 at 16:12 Uwe Mesecke 1,373911 add a comment| up vote 1 down vote You never declare your @child_left variable. share|improve this answer answered Mar 12 '09 at 15:18 Joel Coehoorn 249k92440662 add a comment| up vote 1 down vote Thanks, near '' at line 3 was my problem and the delimit
Tips/Tricks Top Articles Beginner Articles Technical Blogs Posting/Update Guidelines Article Help Forum Article Competition Submit an article or tip Post your Blog quick answersQ&A Ask a Question http://www.codeproject.com/Questions/800789/MySQL-Stored-Procedure-SQL-execution-error-sharp View Unanswered Questions View All Questions... Linux questions C# questions ASP.NET questions SQL questions fabric questions discussionsforums All Message Boards... Application Lifecycle> Running a Business Sales / Marketing Collaboration / Beta Testing Work Issues Design and Architecture ASP.NET JavaScript C / C++ / MFC> ATL / WTL / STL Managed C++/CLI C# Free Tools Objective-C and Swift Database Hardware & Devices> error 1064 System Admin Hosting and Servers Java .NET Framework Android iOS Mobile SharePoint Silverlight / WPF Visual Basic Web Development Site Bugs / Suggestions Spam and Abuse Watch features Competitions News The Insider Newsletter The Daily Build Newsletter Newsletter archive Surveys Product Showcase Research Library CodeProject Stuff communitylounge Who's Who Most Valuable Professionals The Lounge The Insider News The Weird & mysql error 1064 The Wonderful The Soapbox Press Releases Non-English Language > General Indian Topics General Chinese Topics help What is 'CodeProject'? General FAQ Ask a Question Bugs and Suggestions Article Help Forum Site Map Advertise with us About our Advertising Employment Opportunities About Us Ask a Question All Questions All Unanswered FAQ MySQL Stored Procedure (SQL execution error #1064) Rate this: Please Sign up or sign in to vote. See more: SQL CREATE PROCEDURE get_scheduledMsg() BEGIN DECLARE _dateformat varchar(100); SET _dateformat = SELECT DATE_FORMAT(NOW(), '%Y-%m-%d %H:%i'); SELECT * FROM studentdetails WHERE classCode IS IN (SELECT class FROM messagedetails WHERE isStatus ='1' AND datecreated = _dateformat) AND sectionCode IS IN (SELECT class FROM messagedetails WHERE isStatus ='1' AND datecreated = _dateformat); END; SQL execution error #1064. Response from database: 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 'SELECT DATE_FORMAT(NOW(), '%Y-%m-%d %H:%i'); SELECT * FROM studentdetails WHERE' at line 4 Posted 25-Jul-14 1:07am Mohammed_Faisal1.4K Add a Solution 1 solution Rate this: Please Sign