title: Issue with MYSQL cursor in a stored procedure
body: <p>I am converting stored procs from MSSQL to MYSQL and am stuck at a certain point . I am receiving an error on DEALLOCATE Duration_Cursor error is UNEXPECTED IDENT_QUOTED expecting PREPARE_SYM . If i remove the line DEALLOCATE CURSOR i receive error on END WHILE saying unexpected WHILE expecting IF. I know it is a trivial mistake but i do not seem to get it below is the code :</p>
  
  <pre><code>FETCH NEXT FROM Duration_Cursor INTO m_Duration   ; 
  
   IF  (@@FETCH_STATUS = 0  )       
    THEN          
  
   WHILE (@InnerFlag=1)          
     DO          
       SET m_MIN = m_Duration / 30;          
       SET m_SEC = m_Duration % 30;          
  
      IF (m_MIN=0 )       
        THEN        
         SET m_MIN=1;       
         SET m_SEC=0;       
  
  
     ELSE if (m_SEC &gt;= 15)           
       THEN          
        set m_MIN=m_MIN+1 ;         
        SET m_SEC=0 ;                 
  
     ELSE if (m_SEC &lt; 15 AND m_SEC &gt; 0) 
      THEN         
        SET m_SEC=50 ;-- 45                     
  
     END IF;        
  
  
  
       SET m_CommuSum_MIN_US = m_CommuSum_MIN_US + cast( CONCAT(CAST( m_MIN as  char(5)),'.', CAST( m_SEC as char(5))) as decimal);          
  
  
      FETCH NEXT FROM Duration_Cursor INTO m_Duration ;         
  
  
     IF (@@FETCH_STATUS &lt;&gt; 0)          
                THEN          
  
      SET InnerFlag = 0 ;    
              DEALLOCATE Duration_Cursor;         
        END IF;
  
        END WHILE;
  
  
    END IF ;
  </code></pre>
  
  <p>Can someone help please</p>