我有一个 MySQL 游标,但我需要将其设置为只读且不可滚动,但如何在存储过程中设置它?
我的存储过程看起来像
DROP PROCEDURE IF EXISTS `GetAllNonprocessedSMSes` €€
CREATE PROCEDURE `GetAllNonprocessedSMSes`()
BEGIN
...
DECLARE id_cur CURSOR FOR
SELECT `id` FROM (
SELECT
MIN(`id`) AS `id`
FROM
`inbox`
WHERE
`Processed`='false'
AND `udh`=''
) AS `baseview`
ORDER BY `id`;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET finish = TRUE;
OPEN id_cur;
the_loop : LOOP
FETCH id_cur INTO smsid;
...
END LOOP the_loop;
...
END €€