title: Issue in adding two outputs from MySQL function inside another function
body: <pre><code>CREATE DEFINER=`root`@`localhost` FUNCTION `F_GetProjectCostPerEmployeeInProject`(id VARCHAR(20)) RETURNS DECIMAL(30,2)
  BEGIN
      DECLARE e_id VARCHAR(20);
      DECLARE finished INT ;
      DECLARE temp DECIMAL(30,2);
      DECLARE temp2 DECIMAL(30,2);
      DECLARE TotalCostOfEmployees DECIMAL(30,2);
      DECLARE cur CURSOR FOR SELECT DISTINCT e_id FROM project_employee WHERE project_id=id;
      DECLARE CONTINUE HANDLER FOR NOT FOUND SET finished = 1;
      emploop : LOOP
          FETCH cur INTO e_id;
          IF finished =1 ;
              LEAVE emploop;
          END IF ;
  
          SET TotalCostOfEmployees = TotalCostOfEmployees + ( F_TotalManDaysPerEmployee(e_id,id)*(F_GetEmployeeGradeSal(e_id));
      END LOOP emploop;
      RETURN TotalCostOfEmployees;
      END$$
  </code></pre>
  
  <p>The problem is its giving error at line : </p>
  
  <pre><code>SET TotalCostOfEmployees = TotalCostOfEmployees + ( F_TotalManDaysPerEmployee(e_id,id)*(F_GetEmployeeGradeSal(e_id));
  </code></pre>
  
  <p>This is the error : </p>
  
  <blockquote>
    <p>Error Code : 1064 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 ';           leave emploop;      end if ;</p>
  
  <pre><code>  set TotalCostOfEmployees = TotalCostOfEmploy' at line 12
  </code></pre>
  </blockquote>