MySQL Forums
Forum List  »  Stored Procedures

Re: Begin..End not accepted in stored procedures/functions?
Posted by: Lee Wood
Date: January 25, 2009 01:11PM

The difference between the two versions (i.e. the one with BEGIN-END, and the one without) is that the former requires that you include ";" within the body of the stored function, which inadvertently ends the CREATE FUNCTION statement.

To get around this, you must temporarily change the delimiter to something else, and change it back to ";" after the function definition.
e.g.
DELIMITER $$
CREATE FUNCTION TESTFUNC( x INT )
RETURNS INT
DETERMINISTIC
BEGIN RETURN x+1;
END$$
DELIMITER ;

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: Begin..End not accepted in stored procedures/functions?
2743
January 25, 2009 01:11PM


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.