...

View Full Version : Resolved Strange error about a FUNCTION that does not exists.



sethleedy
01-25-2012, 03:11 PM
I am getting a message from MySQL Workbench that makes no sense to me.
SELECT update_customers_groups(1) LIMIT 0, 1000 Error Code: 1305. FUNCTION ph_digistore.update_customers_groups does not exist

The code below is the entirety and should work as far as I can tell.
This also pops up but, should work. CREATE FUNCTION update_customers_groups() RETURNS INTEGER MODIFIES SQL DATA BEGIN DECLARE email_todo VARCHAR(255); DECLARE my_cursor CURSOR FOR SELECT email FROM wholesale_import_table; OPEN my_cursor; loopty:REPEAT FETCH my_cursor INTO email_todo; UPDATE ds_customers SET pgID = 1 WHERE ds_customers.cEmail = @email_todo; UNTIL done END REPEAT loopty; CLOSE my_cursor; RETURN 0; END; Error Code: 1418. This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable)
Yeah, if the FUNCTION errors on creation, the first error will be created too. Just what is wrong? I consulted from many sources on the net for examples.


DELIMITER ;

USE ph_digistore;

DROP FUNCTION IF EXISTS update_customers_groups;

DELIMITER $$

CREATE FUNCTION update_customers_groups() RETURNS INTEGER MODIFIES SQL DATA

BEGIN

DECLARE email_todo VARCHAR(255);

DECLARE my_cursor CURSOR FOR
SELECT email FROM wholesale_import_table;

OPEN my_cursor;

loopty:REPEAT

FETCH my_cursor INTO email_todo;

UPDATE ds_customers
SET pgID = 1
WHERE ds_customers.cEmail = @email_todo;

UNTIL done END REPEAT loopty;

CLOSE my_cursor;
RETURN 0;

END;

$$

DELIMITER ;


SELECT update_customers_groups();

sethleedy
01-25-2012, 03:33 PM
Looking @ http://www.codingforums.com/showthread.php?t=218894&highlight=create+function
Might be my permissions. BRB.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum