MySQL Forums
Forum List  »  Stored Procedures

I get Syntax errors
Posted by: Md. Tahamedur Rahman
Date: January 05, 2018 05:10AM

Having trouble with this proc. I come from Microsoft SQL background. The code makes sense to me but I get Syntax errors. Any help appreciated. I am under a time constraint. Here is the code:

BEGIN

SET @source_id := 0;
SET @dest_id := 0;
select @source_id = list_id from mw_list l where list_id > @source_id LIMIT 1;

WHILE @source_id IS NOT NULL
select @dest_id = list_id from mw_list where list_id > @dest_id and list_id <> @source_id LIMIT 1;

WHILE @dest_id IS NOT NULL
IF NOT EXISTS (SELECT * from test_list_subscriber_action WHERE source_list_id = @source_id AND
target_list_id = @dest_id AND source_action = ‘unsubscribe’ AND target_action = ‘unsubscribe’)

THEN
INSERT test_list_subscriber_action @source_id, ‘unsubscribe’, @dest_id, ‘unsubscribe’;
END IF;

select @dest_id = list_id from mw_list where list_id > @dest_id and list_id <> @source_id LIMIT 1;

END WHILE;
select @source_id = list_id from mw_list l where list_id > @source_id LIMIT 1;
END WHILE;

END

http://www.healthfitnesz.com/

Options: ReplyQuote


Subject
Views
Written By
Posted
I get Syntax errors
1174
January 05, 2018 05:10AM
245
January 26, 2018 10:28AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.