Use the SELECT ... INTO clause SELECT TotalCostOfEmployees + ( F_TotalManDaysPerEmployee(e_id,id)*(F_GetEmployeeGradeSal(e_id)) INTO TotalCostOfEmployees.
. That helped me out.... I being a newbie in mysql.... so made a mistake :) – Joy Jan 13 at 19:07 @Joy np. Please remember to accept the answer to your question :-) – The Scrum Meister Jan 13 at 19:10 sorry I guess I posted my another problem here I m facing in a wrong section can you please look after tht?
– Joy Jan 13 at 19:13.
Well thnks for d info it solved d problem but still facing a weird problem in addition.. likewise : DECLARE finished INT ; DECLARE salary DECIMAL(30,2); DECLARE TotalCostOfEmployees DECIMAL(30,2) DEFAULT 0.0; DECLARE cur CURSOR FOR SELECT DISTINCT e_id FROM project_employee WHERE project_id=id; DECLARE CONTINUE HANDLER FOR NOT FOUND SET finished = 1; OPEN cur; emploop : LOOP FETCH cur INTO e_id; IF finished =1 THEN LEAVE emploop; END IF ; SELECT F_TotalManDaysPerEmployee(e_id,id)* F_GetEmployeeGradeSal(e_id) INTO salary; SET TotalCostOfEmployees = TotalCostOfEmployees + IFNULL(salary,0.0); END LOOP emploop; CLOSE cur; RETURN TotalCostOfEmployees; its returning 0.00 howeva I m dead sure ...it shdnt be .. cause the first and 3rd e_id contains values for salary.....
I there I solved it via this way... hope this may help someone else in future : enter code BEGIN DECLARE e_id VARCHAR(20); DECLARE finished INT ; DECLARE salary DECIMAL(30,2); DECLARE TotalCostOfEmployees DECIMAL(30,2) ; DECLARE cur CURSOR FOR SELECT DISTINCT Emp_code FROM project_employee WHERE project_id=p_id; DECLARE CONTINUE HANDLER FOR NOT FOUND SET finished = 1; SET finished = 0; OPEN cur; SET TotalCostOfEmployees =0.0; emploop : LOOP FETCH cur INTO e_id; IF finished = 1 THEN LEAVE emploop; END IF ; SELECT COALESCE( (F_TotalManDaysPerEmployee(e_id,p_id)* F_GetEmployeeGradeSal(e_id))/22,0.0) INTO salary; SET TotalCostOfEmployees = TotalCostOfEmployees + salary; /*SELECT (TotalCostOfEmployees + ifnull(salary,0.0)) into TotalCostOfEmployees; */ END LOOP emploop; CLOSE cur; RETURN TotalCostOfEmployees; END$$.
SELECT SUM(F_TotalManDaysPerEmployee(e_id, id) * F_GetEmployeeGradeSal(e_id)) AS TotalCostOfEmployees FROM ( SELECT DISTINCT e_id FROM project_employee WHERE project_id = id ) q.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.