我正在处理的存储过程有时会出错.我得到的结果包含多个行错误,但仅限于某些JOB_ID_INPUT值.我明白是什么导致了这个错误,所以我试着非常小心地确保我的返回值在它们应该是标量时.很难看到存储过程,所以我不确定可以在哪里生成错误.由于错误是有条件地抛出的,因此我认为内存可能是一个问题,或者游标重用.我不经常使用游标,所以我不确定.谢谢任何帮助过的人.
DROP PROCEDURE IF EXISTS export_job_candidates;
DELIMITER $$
CREATE PROCEDURE export_job_candidates (IN JOB_ID_INPUT INT(11))
BEGIN
DECLARE candidate_count INT(11) DEFAULT 0;
DECLARE candidate_id INT(11) DEFAULT 0;
# these are the ib variables
DECLARE _overall_score DECIMAL(5, 2) DEFAULT 0.0;
# declare the cursor that will be needed for this SP
DECLARE curs CURSOR FOR SELECT user_id FROM job_application WHERE job_id = JOB_ID_INPUT;
# this table stores all of the data that will be returned from the various tables that will be joined together to build the final export
CREATE TEMPORARY TABLE IF NOT EXISTS candidate_stats_temp_table (
overall_score_ib DECIMAL(5,