我对PL/SQL非常陌生,最近我创建了一个新程序,它似乎可以正确编译,但是当我执行该程序时,它不显示任何内容。PLSQL BETWEEN过程不起作用
我想要完成的是选择带有受影响的两个输入之间的房屋的最大数量的邮政编码,这些输入是outage_start_time timestamp,outage_end_time时间戳。
表: OUTAGE_ID,OUTAGE_START,OUTAGE_END,OUTAGE_ZIPCODE,OUTAGE_STATUS,HOUSES_AFFECTED
步骤:
create or replace procedure start(outage_start_time timestamp, outage_end_time timestamp)
as
Cursor test is
select outage_zipcode
from outage
where HOUSES_AFFECTED in (select max(HOUSES_AFFECTED)from outage)
and outage_start_time between outage_start and outage_end
and outage_end_time between outage_start and outage_end;
average varchar(256);
BEGIN
Open test;
Loop
fetch test into average;
exit when test%notfound;
dbms_output.put_line(average);
end loop;
end;
你在这里写的程序是不完整的。请提供全文。 – Dmitry
更新了整个过程 – user2402107
您是否正在运行sqlplus,并且您是否在运行之前设置了SERVEROUTPUT ON? (即尝试编写一个只写出“hello world”的程序,并确保它适用于您;然后确保您的查询实际返回结果,...) – Glenn