MySQL Forums
Forum List  »  Stored Procedures

Begin..End not accepted in stored procedures/functions?
Posted by: Bram Van Gerssel
Date: January 25, 2009 12:45PM

When I try to create a function with a BEGIN .. END block, I get an error. When I try this:
CREATE FUNCTION TESTFUNC( x INT )
 RETURNS INT
 DETERMINISTIC
 BEGIN RETURN x+1; END;
I get this 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 '' at line 4
When I try the same without BEGIN and END (i.e. just "RETURN x+1;" on the last line), everything works just fine.

I need to use more complex functions that do require BEGIN - END notation. Any idea what can be wrong here?

(PS. Just in case it helps: Server version: 5.0.51a-3ubuntu5.4, MySQL client version: 5.0.51a)

(PS2. Sorry, I thought I was posting in the 'Stored Procedures' forum.. can a moderator move it?)



Edited 1 time(s). Last edit at 01/25/2009 12:48PM by Bram Van Gerssel.

Options: ReplyQuote


Subject
Views
Written By
Posted
Begin..End not accepted in stored procedures/functions?
6366
January 25, 2009 12:45PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.