CREATE DEFINER=`mycommcrm`@`%` PROCEDURE `insert_source_flag`(IN `tableName` varchar(60))
BEGIN
#原始欠费数据 暂依据 客户唯一标记,起始账期,结束账期,账务月份区分
declarev_start_time datetime DEFAULT now();
declare startAccountDate varchar(64); -- 起始账期
declare endAccountDate varchar(64); -- 结束账期
declare accountMonth varchar(64); -- 账务月份
declare onlyFlag int;
declarea int DEFAULT 0;
-- 遍历数据结束标志
declare ifEnd int DEFAULT false;
-- 声明游标
DECLARE cti_dialout_temp_curs cursor for (
select start_account_date,end_account_date,account_month,only_flag from cti_dialout_temp
);
-- 将结束标志绑定到游标
declare CONTINUE HANDLER FOR not found SET ifEnd = true;
-- 打开游标
open cti_dialout_temp_curs;
-- 循环遍历
read_loop: LOOP
-- 提取变量值
fetch cti_dialout_temp_curs into startAccountDate,endAccountDate,accountMonth,onlyFlag;
-- 判断是否退出循环
IF ifEnd THEN
LEAVE read_loop;
END IF;
---
Mysql游标中拼接sql字符串执行
最新推荐文章于 2022-01-17 21:35:46 发布
CREATE DEFINER=`mycommcrm`@`%` PROCEDURE `insert_source_flag`(IN `tableName` varchar(60))BEGIN#原始欠费数据 暂依据 客户唯一标记,起始账期,结束账期,账务月份区分 declarev_start_time datetime DEFAULT now(); declare startAc...
摘要由CSDN通过智能技术生成