Go Back   CodingForums.com > :: Server side development > MySQL

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-25-2012, 03:11 PM   PM User | #1
sethleedy
New to the CF scene

 
Join Date: Jan 2012
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
sethleedy is an unknown quantity at this point
Question Strange error about a FUNCTION that does not exists.

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.
Code:
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();

Last edited by sethleedy; 01-25-2012 at 03:58 PM..
sethleedy is offline   Reply With Quote
Old 01-25-2012, 03:33 PM   PM User | #2
sethleedy
New to the CF scene

 
Join Date: Jan 2012
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
sethleedy is an unknown quantity at this point
Looking @ http://www.codingforums.com/showthre...reate+function
Might be my permissions. BRB.
sethleedy is offline   Reply With Quote
Reply

Bookmarks

Tags
create, error, function

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 07:32 AM.


Advertisement
Log in to turn off these ads.