Click to See Complete Forum and Search --> : Unable to create function in database


raydona
May 17th, 2009, 01:52 PM
Hi,
I have created the following function to verify that an employee is registered (i.e. on database). Function returns 1 if true and 0 if false:

DROP FUNCTION IF EXISTS VerifyAnEmployee;
DELIMITER |
CREATE FUNCTION VerifyAnEmployee(surname VARCHAR(15),email VARCHAR(40))
RETURNS INT
DETERMINISTIC
READS SQL DATA
BEGIN
DECLARE query INT;
DECLARE str1 VARCHAR(15);
DECLARE str2 VARCHAR(40);
SET str1 = '';
SET str2 = '';
SELECT LastName, EmailAddress INTO str1, str2
FROM Employee
WHERE LastName = surname AND EmailAddress = email;
IF(str1 = surname AND str2 = email) THEN SET query = 1;
ELSE SET query = 0;
END IF;
RETURN query;
END;
|
I get the following error:
#1419 - You do not have the SUPER privilege and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable)
I don't know what the error means especially as the database administrator has granted me all the privileges. How do I resolve the problem? I would be grateful for all help.