0
我的觸發器完全安裝成功,但更新後表顯示錯誤。請讓我知道需要更改此代碼。更新表後觸發器不工作
#1328 - Incorrect number of FETCH variables
DELIMITER //
CREATE TRIGGER `getcrm`.`update_round_date` AFTER UPDATE ON `getcrm`.`vtiger_stockcheckcf`
FOR EACH ROW BEGIN
DECLARE done INT DEFAULT 0;
DECLARE curTipo CURSOR FOR SELECT * FROM vtiger_crmentity LEFT JOIN
vtiger_stockcheck ON
vtiger_crmentity.crmid = vtiger_stockcheck.stockcheckid LEFT JOIN
vtiger_stockcheckcf ON
vtiger_crmentity.crmid = vtiger_stockcheck.stockcheckid WHERE
vtiger_stockcheckcf.cf_746 = 'Pending';
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done=1;
OPEN curTipo;
ins_loop: LOOP
FETCH curTipo INTO crmid,smcreatorid,smownerid,modifiedby,createdtime,modifiedtime,curEdate,
stockcheck,stockcheckid,cf_709,cf_710,cf_711,cf_712,cf_713,cf_714,cf_715,cf_716,cf_717,cf_718,cf_719,cf_720,cf_721,cf_722,cf_723,cf_724,
cf_725,cf_726,cf_727,cf_728,cf_729,cf_730,cf_731,cf_732,cf_733,cf_734,cf_735,cf_736,cf_737,cf_738,cf_739,cf_740,cf_741,cf_742,cf_743,cf_744,
cf_745,cf_746,cf_747,cf_748,cf_844,cf_1079,cf_1080,cf_1081;
IF done THEN
LEAVE ins_loop;
END IF;
INSERT INTO vtiger_cancellationcf values ('vtiger_crmentity.crmid','vtiger_stockcheckcf.cf_709','vtiger_stockcheckcf.cf_710',
'vtiger_stockcheckcf.cf_711','vtiger_stockcheckcf.cf_712',`vtiger_stockcheckcf.cf_713`,`vtiger_stockcheckcf.cf_714`,`vtiger_stockcheckcf.cf_715`,
`vtiger_stockcheckcf.cf_716`,`vtiger_stockcheckcf.cf_717`,`vtiger_stockcheckcf.cf_718`,`vtiger_stockcheckcf.cf_719`,`vtiger_stockcheckcf.cf_720`,
`vtiger_stockcheckcf.cf_721`,`vtiger_stockcheckcf.cf_722`,`vtiger_stockcheckcf.cf_723`,`vtiger_stockcheckcf.cf_724`,`vtiger_stockcheckcf.cf_725`,
`vtiger_stockcheckcf.cf_726`,`vtiger_stockcheckcf.cf_727`,`vtiger_stockcheckcf.cf_728`,`vtiger_stockcheckcf.cf_729`,`vtiger_stockcheckcf.cf_730`,
`vtiger_stockcheckcf.cf_731`,`vtiger_stockcheckcf.cf_732`,`vtiger_stockcheckcf.cf_733`,`vtiger_stockcheckcf.cf_734`,`vtiger_stockcheckcf.cf_735`,
`vtiger_stockcheckcf.cf_736`,`vtiger_stockcheckcf.cf_737`,`vtiger_stockcheckcf.cf_738`,`vtiger_stockcheckcf.cf_739`,`vtiger_stockcheckcf.cf_740`,
`vtiger_stockcheckcf.cf_741`,`vtiger_stockcheckcf.cf_742`,`vtiger_stockcheckcf.cf_743`,`vtiger_stockcheckcf.cf_744`,`vtiger_stockcheckcf.cf_745`,
`vtiger_stockcheckcf.cf_746`,`vtiger_stockcheckcf.cf_747`,`vtiger_stockcheckcf.cf_748`,`vtiger_stockcheckcf.cf_844`,`vtiger_stockcheckcf.cf_1079`,
`vtiger_stockcheckcf.cf_1080`,`vtiger_stockcheckcf.cf_1081`);
INSERT INTO vtiger_cancellation (cancellationid,cancellation,scheckid)
values ('vtiger_crmentity.crmid',' ','vtiger_stockcheckcf.cf_709');
INSERT INTO vtiger_crmentity values
('vtiger_crmentity.crmid','vtiger_crmentity.smcreatorid','vtiger_crmentity.smownerid',
'vtiger_crmentity.smcreatorid','Cancellation','','curEdate','curEdate','','','0','1','0','');
DELETE FROM vtiger_crmentity_seq where id='vtiger_crmentity.crmid';
INSERT INTO vtiger_crmentity_seq values ('vtiger_crmentity.crmid');
END LOOP;
CLOSE curTipo;
END
//
DELIMITER
代碼在哪裏? –
只是在黑暗中瘋狂的猜測,但它聽起來像你有一個遊標,選擇x列,並試圖在y變量中獲取它們... – Stephan
我已經聲明所有變量 –