用limit 传变量TO 存储过程解决方案

用limit 传变量TO 存储过程解决方案
DELIMITER $$

DROP PROCEDURE IF EXISTS `dbase`.`paper` $$
CREATE DEFINER=`root`@`localhost` PROCEDURE `paper`(in id int)
BEGIN
/*declare a BIGINT ;
set a=3;*/
prepare stmt from"

select   ques_id from exam_question t
where  ques_subject='01'
order by rand() limit ?";
set @a=id;
execute stmt using @a;
END $$

DELIMITER ;

你可能感兴趣的:(limit)