DROP procedure IF EXISTS `eword_get`; DELIMITER $$ CREATE PROCEDURE eword_get(word_count INT) BEGIN DECLARE n INT DEFAULT 0; DECLARE i INT DEFAULT 0; TRUNCATE TABLE eword800_temp; WHILE (i < word_count) DO select a.idx into n from eword800 a, (select FLOOR(RAND()*800 + 1) as idx ) b where a.use_flag = 'Y' and a.idx =b.idx; INSERT INTO eword800_temp (idx, word, meaning) select idx, word, meaning ..