mysql存储过程列错误

时间:2011-12-25 13:17:33

标签: mysql database stored-procedures

我收到以下错误。但我没有在我的存储过程中键入计数,所以为什么它会给出这个错误?

  CALL updateproposalStatus(1,5)    Error Code: 1136. Column count doesn't match value count at row 1

存储程序:

CREATE DEFINER=`root`@`localhost` PROCEDURE `updateProposalStatus`(IN decision INT, IN x INT)
BEGIN
DECLARE adv_id varchar(30);
DECLARE std_id varchar(30);
DECLARE topic varchar(255);

select
 a.id INTO adv_id
 from
 rp_proposal p
 inner join rp_adviser a on p.rp_adviser_id = a.id
 where p.proposal_id=x;

 select
 s.id INTO std_id
 from
 rp_proposal p
 inner join rp_student s on p.rp_student_id = s.id
 where p.proposal_id=x;

 select
 p.title INTO topic
 from
 rp_proposal p
 where p.proposal_id=x;

UPDATE rp_proposal_status
SET state_rp_controller =decision
WHERE rp_proposal_id = x;

IF decision = 1 THEN
INSERT INTO rp_indpstudy VALUES (topic,adv_id,std_id);
END IF;
END

1 个答案:

答案 0 :(得分:1)

它是抱怨的列数(列数),而不是名为count的列。

最有可能的罪魁祸首是最后的insert语句 - 确保它与rp_indpstudy的架构一致。