I'm trying to use existing functions from a restored database from 5.0xx to
5.1, and get an error about the mysql.proc table is missing or corrupt. The
mysql.proc table appears to be there, and does not appear to be corrupt. I
did a grant select on mysql.proc to user, and that did not make any
difference, as it has in the past. So, I decided that I'd delete the
function from the database, and try to add it back in, and when I do, I get
an error, Failed to CREATE FUNCTION.
The code that I'm trying to execute is as follows:
CREATE DEFINER = 'root'@'localhost' FUNCTION `Age`(dob DATE)
SQL SECURITY DEFINER
DECLARE today DATE;
SELECT CampStartDate INTO today FROM config;
RETURN DATE_FORMAT(FROM_DAYS(TO_DAYS(today) - TO_DAYS(dob)), '%Y') + 0;
Any ideas what's going on?