众生皆寂 2015-06-09 14:51 采纳率: 50%
浏览 3399
已采纳

PLSQL循环嵌套查询,查询结果一直不打印输出

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;

 后台没有打印信息,一直在执行,也没有结束,不是死循环呀,大神帮忙看看
  • 写回答

1条回答 默认 最新

  • 青春唱不完的歌 2015-06-09 15:34
    关注

    最上面加一句 set serveroutput on试试

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器