mysql修复数据存储过程
DROP PROCEDURE IF EXISTS test;
CREATE PROCEDURE test(
in infoSetName VARCHAR(50),
in itemName VARCHAR(50),
in itemId VARCHAR(50),
in itemCode VARCHAR(50),
in dataType int(4),
in dataTypeId VARCHAR(50),
in defdoclistId VARCHAR(50),
in entryListShow tinyint(1),
in entryCardShow tinyint(1),
in showOrder int(4)
)
BEGIN
-- Date 2020-12-24
-- 调用存储过程
-- call test('培训记录','取得证书名称','1','certificate',1,NULL,NULL,1,1,8);
DECLARE parentId varchar(50);
DECLARE done INT DEFAULT FALSE;
declare cur CURSOR for SELECT id from test where infoset_name=infoSetName;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
delete from corehr.cs_appconf_item where item_name=itemName;
OPEN cur;
read_loop: LOOP
FETCH cur INTO parentId;
IF done THEN LEAVE read_loop;
END IF;
INSERT INTO test(`id`, `set_id`, `item_id`, `item_code`, `item_name`, `data_type`, `max_length`, `precise`, `data_type_id`, `defdoclist_id`, `unentry_list_show`, `entry_list_show`, `manager_list_show`, `unentry_card_show`, `entry_card_show`, `manager_card_show`, `unentry_editable`, `entry_editable`, `unentry_not_null`, `entry_not_null`, `unentry_leaf_select`, `entry_leaf_select`, `showorder`, `entry_approval`, `ts`, `dr`, `tenantid`)
VALUES (uuid(), parentId, itemId, itemCode, itemName, dataType, 50, 0, dataTypeId, defdoclistId, 0, entryListShow, 0, 0, entryCardShow, 0, 0, 0, 0, 0, NULL, NULL, showOrder, 0, '2020-12-24 12:00:00', 0, 'wnubbh0f');
END LOOP;
CLOSE cur;
END;