DarkReaper Posted November 19, 2006 Share Posted November 19, 2006 hi, there i have the following problem:i have a stored function which i want to alter so i do this:[code]alter function naemi ( _carid int(10), _egn char(10), _price float, _ime char(100), _familiq char(100)) RETURNS timestampbegindeclare returncheck timestamp;select datanavryshtane into returncheck from clients where carid=_carid order by datanavryshtane asc limit 1;return returncheck;end[/code]but it returns the following 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 '( _carid int(10), _egn char(10), _price float, _ime char(100), _familiq char(100' at line 1 i have changed the delimiter to //, also all of the needed tables in the function exists. I just dont get it ... why would an error occur ... help!? Link to comment https://forums.phpfreaks.com/topic/27754-stored-function-problems/ Share on other sites More sharing options...
DarkReaper Posted November 19, 2006 Author Share Posted November 19, 2006 okay another problem ... (the above one i've solved using drop function before the create, obviously my alter syntax is wrong) ... but the following error occures now:[code]create function naemi ( _carid int, _egn char(10), _price float, _ime char(100), _familiq char(100)) RETURNS char(255)begindeclare returncheck timestamp;select datanavryshtane into returncheck from clients where carid=_carid order by datanavryshtane asc limit 1;if (datanavryshtane = '0000-00-00 00:00:00') then return 'Not returned'else return 'returned'end if;end[/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 'return 'Not returned'else return 'returned!'end if;I guess my if conditions are wrong ... but its a standard if function .. i've checked the manual ... any ideas why is this not working???? Link to comment https://forums.phpfreaks.com/topic/27754-stored-function-problems/#findComment-127008 Share on other sites More sharing options...
printf Posted November 19, 2006 Share Posted November 19, 2006 Missing [b]semicolon[/b] at the end of each of your RETURN values;printf Link to comment https://forums.phpfreaks.com/topic/27754-stored-function-problems/#findComment-127113 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.