MySQL Forums
Forum List  »  Source, Builds, Binaries

Re: Error: 1064, when create function in Query Browser
Posted by: Erhhung Yuan
Date: November 10, 2006 06:30PM

If you are sending the text of this create function statement to MySQL server from the browser or the command-line client, then you have to set the proper delimiter first. You are getting error 1064 because the MySQL client sends the incomplete statement immediately after seeing the ending semi-colon after the "declare ..." line.

Since semi-colon is the default delimiter, you can write your script in a file like this, and then just "source" the file.

delimiter |

create function foo (x int) returns int
begin
declare y int;
set y = x + 1;
return y;
end|

delimiter ;

(make sure there is no CR/LF after the "delimiter ;" line at the end of the file, or else the delimiter isn't properly changed).

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: Error: 1064, when create function in Query Browser
3774
November 10, 2006 06:30PM


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.