MySQL Forums :: Stored Procedures :: Procedure will not run


Advanced Search

Re: Procedure will not run
Posted by: Peter Brawley ()
Date: July 26, 2016 11:15AM

DROP PROCEDURE IF EXISTS sp_Page_View_Update;
DELIMITER go
CREATE PROCEDURE sp_Page_View_Update()
  MODIFIES SQL DATA                                        -- NO SEMICOLON
BEGIN
  DECLARE l_Cnt     BIGINT DEFAULT 1;
  DECLARE l_Page_ID   BIGINT;
  DECLARE l_Viewer_Name   VARCHAR(255);
  DECLARE l_View_Date   DATETIME DEFAULT NOW();
  DECLARE l_Done      INT DEFAULT 0;
  DECLARE cur1 CURSOR FOR 
    SELECT  CONTENT.CONTENTID, user_mapping.lower_username
    FROM CONTENT, user_mapping
    Where CONTENTTYPE = "PAGE"AND CONTENT_STATUS = "current" 
      AND CONTENT.LASTMODIFIER = user_mapping.user_key
    Order by TITLE, VERSION DESC,CREATOR, LASTMODDATE;
    DECLARE CONTINUE HANDLER FOR NOT FOUND SET l_Done=1;
    SET l_Cnt = l_Cnt + 1;
  OPEN cur1;
  insert_loop: LOOP
    FETCH cur1 INTO l_Page_ID, l_Viewer_Name;              -- MISSING SEMICOLON
    IF l_Done = 1 THEN
      LEAVE insert_loop ;                                  -- MISSING SEMICOLON
    End IF ;                                               -- MISSING SEMICOLON
    INSERT INTO AO_1991C6_PAGE_VIEW(ID,PAGE_ID,VEIWER_ID,VIEW_DATE) 
      VALUES(l_Cnt,l_Page_ID,l_Viewer_Name,l_View_Date) ;  -- MISSING SEMICOLON
      SET l_Cnt = l_Cnt + 1 ;                              -- MISSING SEMICOLON
  END LOOP insert_loop;
  CLOSE cur1;
END;
go
DELIMITER ;

Options: ReplyQuote


Subject Views Written By Posted
Procedure will not run 2494 Greg Della-Croce 07/26/2016 07:43AM
Re: Procedure will not run 330 Peter Brawley 07/26/2016 11:15AM
Re: Procedure will not run 283 Greg Della-Croce 07/27/2016 07:29AM


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.