create procedure Sp_Sync_Log(in ptype varchar(32))
begin
declare r_c_logid VARCHAR(32);
declare v_cursor CURSOR FOR select TXN_HOUR_LOG.c_logid from txn_hour_log where TXN_HOUR_LOG.c_statflag = 'N';
open v_cursor;
LOOP_LABLE:loop
fetch v_cursor into r_c_logid;
while (r_c_logid is not null) do
insert into txn_log select * from txn_hour_log where txn_hour_log.c_logid in (r_c_logid);
if(ifnull(ptype,0)=0) then
insert into txn_stat select * from txn_hour_log where txn_hour_log.c_logid in (r_c_logid);
end if;
update txn_hour_log set c_statflag='S' where txn_hour_log.c_logid in (r_c_logid);
end while;
end loop;
DELETE FROM TXN_HOUR_LOG
WHERE TIMESTAMPDIFF(DAY,date_format(d_date,'%y-%m-%d'),date_format(now(),'%y-%m-%d'))>0
AND c_statflag = 'S';
COMMIT;
close v_cursor;
end;//这个存储过程中 DELETE语句总是不执行,大家看看我那里写错了吗SQL存储
begin
declare r_c_logid VARCHAR(32);
declare v_cursor CURSOR FOR select TXN_HOUR_LOG.c_logid from txn_hour_log where TXN_HOUR_LOG.c_statflag = 'N';
open v_cursor;
LOOP_LABLE:loop
fetch v_cursor into r_c_logid;
while (r_c_logid is not null) do
insert into txn_log select * from txn_hour_log where txn_hour_log.c_logid in (r_c_logid);
if(ifnull(ptype,0)=0) then
insert into txn_stat select * from txn_hour_log where txn_hour_log.c_logid in (r_c_logid);
end if;
update txn_hour_log set c_statflag='S' where txn_hour_log.c_logid in (r_c_logid);
end while;
end loop;
DELETE FROM TXN_HOUR_LOG
WHERE TIMESTAMPDIFF(DAY,date_format(d_date,'%y-%m-%d'),date_format(now(),'%y-%m-%d'))>0
AND c_statflag = 'S';
COMMIT;
close v_cursor;
end;//这个存储过程中 DELETE语句总是不执行,大家看看我那里写错了吗SQL存储
begin
declare r_c_logid VARCHAR(32);
declare v_cursor CURSOR FOR select TXN_HOUR_LOG.c_logid from txn_hour_log where TXN_HOUR_LOG.c_statflag = 'N';
open v_cursor;
LOOP_LABLE:loop
fetch v_cursor into r_c_logid;
while (r_c_logid is not null) do
insert into txn_log select * from txn_hour_log where txn_hour_log.c_logid in (r_c_logid);
if(ifnull(ptype,0)=0) then
insert into txn_stat select * from txn_hour_log where txn_hour_log.c_logid in (r_c_logid);
end if;
update txn_hour_log set c_statflag='S' where txn_hour_log.c_logid in (r_c_logid);
end while;
end loop;select 123455;
DELETE FROM TXN_HOUR_LOG
WHERE TIMESTAMPDIFF(DAY,date_format(d_date,'%y-%m-%d'),date_format(now(),'%y-%m-%d'))>0
AND c_statflag = 'S';
COMMIT;
select 123456;
close v_cursor;
end;//
ERROR 1329 (02000): No data - zero rows fetched, selected, or processed。可是前面的select,insert都执行了,请问是什么原因呀,是不是我哪里写错了