List:General Discussion« Previous MessageNext Message »
From:Jesse Date:September 27 2008 7:04pm
Subject:MySQL 5.1 Function Creation
View as plain text  
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)
    RETURNS int(11)
    DETERMINISTIC
    CONTAINS SQL
    SQL SECURITY DEFINER
    COMMENT ''
BEGIN
  DECLARE today DATE;
  SELECT CampStartDate INTO today FROM config;
  RETURN DATE_FORMAT(FROM_DAYS(TO_DAYS(today) - TO_DAYS(dob)), '%Y') + 0;
END;

Any ideas what's going on?

Jesse 

Thread
MySQL 5.1 Function CreationJesse27 Sep
  • Re: MySQL 5.1 Function CreationMoon's Father25 Oct