declare
-- Local variables here
i integer := 1;
currentdate timestamp;
ninsdate timestamp;
nseqid number;
ndate varchar2(10);
nspid varchar2(10);
po INTEGER;
begin
ndate := '201506';
nspid := '33474';
po:=0;
select sysdate + 1 / (24 * 60) into currentdate from dual;
ninsdate := currentdate + 1 / 1440;
for c in (select *
from userorder t
where t.producttype = '1'
and substr(t.ordertime, 1, 6) < '201506'
and t.spid = '33474') loop
if (i = 60) then
i := 1;
ninsdate := ninsdate + 1 / (24 * 60);
end if;
--下面代碼沒執行輸出,不確定為什麼
select count(*)
into po
from sgip_report pt
where pt.usernumber = c.usernumber
and pt.insdate > TO_DATE('2015-06-07', 'yyyy-mm-dd')
and pt.state = '0';
dbms_output.put_line(po);--沒有打印結果,我後續判斷用
if po=0 then
--插入操作
end if;
end loop;
end;
後台沒有打印信息,一直在執行,也沒有結束,不是死循環呀,大神幫忙看看
最上面加一句 set serveroutput on試試