我有以下包含游标的存储过程。
但是不要获得实际的id字段值并始终显示为零。
CREATE PROCEDURE `comm_pay_intro`(IN `id` VARCHAR(20), IN `comm_type` VARCHAR(50))
BEGIN
DECLARE i INTEGER;
DECLARE userid varchar(20);
DECLARE idx int(11);
DECLARE curs1 CURSOR FOR SELECT `id`, `user_id`
FROM `temp_table` order by `id`;
set i=1;
OPEN curs1;
read_loop: LOOP
FETCH curs1 INTO idx,userid;
insert into user_commission(rate_id, user_id)
VALUES(1, idx);
END LOOP read_loop;
CLOSE curs1;
END