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
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????
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.