我刚刚开始学习如何在 MYSQL 中编写存储过程,但遇到了障碍。
我写了以下代码:
DELIMITER $$
DROP PROCEDURE IF EXISTS `emscribedx`.`countcodes` $$
CREATE PROCEDURE `emscribedx`.`countcodes` ()
BEGIN
declare doneprocessing int default 0;
declare thisaccount varchar(50);
declare countcursor cursor for select acct from patientid where patienttype='P';
declare continue handler for not found
set doneprocessing = 1;
Fetch countcursor into thisaccount;
Repeat
select * from doc_table where acct = thisaccount;
until doneprocessing = 1
END repeat;
close countcursor;
END $$
DELIMITER ;
我想显示在重复语句之后出现的选择语句的结果。但是我该怎么做呢?当我执行存储过程时,什么都没有发生?
谢谢,
艾略特