Bug #21737 Unable to create user function
Submitted: 20 Aug 2006 9:33 Modified: 20 Aug 2006 12:24
Reporter: Aniruddha Navare Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:4.1.24 OS:Windows (Windows XP)
Assigned to: CPU Architecture:Any
Tags: User Function

[20 Aug 2006 9:33] Aniruddha Navare
Description:
Hi All,

I am using mySQL 4.1.21 version and tried to run following query
-------------------

CREATE FUNCTION getParentID(IDP INT) RETURNS int
BEGIN

DECLARE idRS INT;
DECLARE nameRS varchar(100);
DECLARE displayIDRS INT;

select id,name,displayID into idRS,nameRS,displayIDRS from tblItems
	where ID = (select parentID from tblItems where id = IDP);

if displayIDRS = 15 then
	select id into idRS from tblItems
		where ID = (select parentID from tblItems where id = idRS);
end if;

RETURN idRS;
END

-------------------

It gives me error code 1064 with this error description. 

"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 'END' at line 1"

Please send me details about this .

Thanks
Aniruddha Navare
aniruddha.navare@gmail.com

How to repeat:
Run the function mentioned above and see the error.
[20 Aug 2006 12:24] MySQL Verification Team
Thank you for the bug report. Stored Procedures and Functions are supported
from version 5.0 and up. Please upgrade for.