fotobleu Posted February 20, 2009 Share Posted February 20, 2009 DELIMITER $$ USE ad_behavior; DROP PROCEDURE IF EXISTS maint_pauseAllCreativesNotActiveInAnyAdgroups $$ CREATE PROCEDURE maint_pauseAllCreativesNotActiveInAnyAdgroups() BEGIN DECLARE c_id INT(11) unsigned; DECLARE f_s varchar(255); DECLARE no_more_creatives INT; -- gets creative_ids of all creatives that are not active in any adgroup; DECLARE crs CURSOR FOR select creative_id, group_concat(status SEPARATOR " ") as full_status from adgroup_creatives group by creative_id having full_status NOT LIKE '%active%'; DECLARE CONTINUE HANDLER FOR NOT FOUND SET no_more_creatives=1; -- loops trough the creative_ids that came back from the cursor above and -- updates the creatives status to paused SET no_more_creatives = 0; OPEN crs; creatives_loop:WHILE(no_more_creatives = 0) DO FETCH crs INTO c_id, f_s; IF no_more_creatives = 1 THEN LEAVE creatives_loop; END IF; UPDATE creatives SET STATUS = 'paused' WHERE id = c_id; SELECT concat('Creative : ',c_id,' was paused.') as message; END WHILE creatives_loop; CLOSE crs; SET no_more_creatives = 0; END $$ DELIMITER ; it craps out on the SELECT concat line, saying its not the right syntax : ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '('Creative : ',c_id,' was paused.') as message; END WHILE cr' at line 23 anyone have any ideas, thanks nevermind there were tabs before the select concat statement, stupid me Quote Link to comment https://forums.phpfreaks.com/topic/146170-solved-help-with-printing-out-a-message-in-a-while-loop-in-a-stored-procedure/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.