DROP PROCEDURE IF EXISTS createopinion33;
# 创建存储过程
CREATE PROCEDURE createopinion33()
BEGIN
DECLARE s1 int;
DECLARE _count1 int default 0;
DECLARE n1 int;
DECLARE _count_n1 int default 0;
DECLARE S_ID bigint(20);
DECLARE F_ID bigint(20);
DECLARE F_RID bigint(20);
DECLARE O_ID bigint(20);
DECLARE E_TYPE int;
DECLARE TABLE_NAME varchar(30);
# opinion意见需要的字段
DECLARE _content longtext;
DECLARE _member_id decimal(19);
DECLARE _member_name varchar(255);
DECLARE _create_time varchar(255);
DECLARE niban_oppion_send longtext;
DECLARE hegao_oppion longtext;
DECLARE niban_oppion_recevie longtext;
# 游标循环控制变量
DECLARE done INT DEFAULT 0;
# 定义游标结果集
DECLARE edocSummaryIds CURSOR FOR SELECT id,form_app_id,form_recordid,SUBSTRING(ID,1,LENGTH(ID)-5) oldId,edoc_type FROM edoc_summary;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1;
SELECT count(*) INTO _count1 FROM edoc_summary;
SET s1=1;
# 打开游标
OPEN edocSummaryIds;
WHILE s1<_count1+1 DO
FETCH edocSummaryIds INTO S_ID,F_ID,F_RID,O_ID,E_TYPE;
SELECT tablename INTO TABLE_NAME FROM form_definition_temp WHERE DI = F_ID;
IF E_TYPE = 0 THEN
SET niban_oppion_send = '';