MySQL Forums
Forum List  »  Stored Procedures

Re: I get Syntax errors
Posted by: Peter Brawley
Date: January 26, 2018 10:28AM

drop procedure if exists noname; 
delimiter go                                                                        -- REQUIRED FOR MULTILINE ROUTINES
create procedure noname()
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;   -- MISSING : IN ASSIGNMENT
  WHILE @source_id IS NOT NULL DO                                                   -- MISSING DO
    select @dest_id := list_id                                                      -- MISSING : IN ASSIGNMENT
    from mw_list 
    where list_id > @dest_id and list_id <> @source_id LIMIT 1;
      WHILE @dest_id IS NOT NULL DO                                                 -- MISSING DO
        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 
          VALUES( @source_id, ‘unsubscribe’, @dest_id, ‘unsubscribe’ );              -- MISSING VALUES( ... )
        END IF; 
        select @dest_id := list_id                                                    -- MISSING : IN ASSIGNMENT
        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; -- MISSING : IN ASSIGNMENT
  END WHILE; 
END;                                                                                -- MISING TERMINATING SEMICOLON
go
delimiter ;

Options: ReplyQuote


Subject
Views
Written By
Posted
1579
January 05, 2018 05:10AM
Re: I get Syntax errors
465
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.