Jump to content

stored function problems


DarkReaper

Recommended Posts

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 timestamp
begin
declare 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

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)
begin
declare 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????

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.