MySQL Forums
Forum List  »  Newbie

error using divide operator in function in mysql 5.5.9
Posted by: shariq muzaffar
Date: February 26, 2011 03:01PM

hi, i am using mysql 5.5.9 on windows

could any one tell me what i am missing in the code below

DELIMITER//
CREATE FUNCTION a ()
RETURNS FLOAT
BEGIN
DECLARE b FLOAT;
SET b = 1025/5;
RETURN b;
END//

when ever i use divide operator in function, i get this error

Query : create function a () returns float begin declare b float; set b = 1025

Error Code : 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 5

Execution Time : 00:00:00:000
Transfer Time : 00:00:00:000
Total Time : 00:00:00:000
---------------------------------------------------

Query : 5; return b; end

Error Code : 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 '5;
return b;
end' at line 1

Execution Time : 00:00:00:000
Transfer Time : 00:00:00:000
Total Time : 00:00:00:000
---------------------------------------------------

Options: ReplyQuote


Subject
Written By
Posted
error using divide operator in function in mysql 5.5.9
February 26, 2011 03:01PM
February 26, 2011 04:52PM
February 27, 2011 12:38AM


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.