这是我的存储过程
CREATE PROCEDURE `getAttritionData`(IN `supid` BIGINT, IN `from_date` DATE, IN `to_date` DATE, OUT `attr_rate` FLOAT, OUT `TERM_EMP_CNT` INT)
DETERMINISTIC
BEGIN
DECLARE i INTEGER DEFAULT 0;
DECLARE CNT_EMP INTEGER DEFAULT 0;
DECLARE TOT_EMP INTEGER DEFAULT 0;
DECLARE AVG_HCOUNT INTEGER DEFAULT 0;
SELECT count(employee_id) INTO TERM_EMP_CNT FROM employee WHERE term_date between from_date and to_date AND app_role=1;
WHILE from_date<=to_date DO
SELECT COUNT(EMPLOYEE_ID) INTO CNT_EMP FROM employee WHERE sup_id=supid AND doj<from_date AND (term_date>from_date OR term_date='0000-00-00') AND app_role=1;
SET from_date=date_add(from_date, INTERVAL 1 DAY);
SET i=i+1;
SET TOT_EMP = TOT_EMP + CNT_EMP;
END WHILE;
SET AVG_HCOUNT=(TOT_EMP/i)*365/12;
SET attr_rate = TERM_EMP_CNT/AVG_HCOUNT;
END
我想将attr_rate作为数组,其中有一个键,另一个是
等值attr_rate[6-2015]=3.5
attr_rate[7-2015]=6.2
attr_rate[8-2015]=3.3
如何在MySQL存储过程中声明一个数组。
由于