【发布时间】:2020-12-26 08:20:10
【问题描述】:
在这个循环中,我想捕获在循环中不返回数据的函数,以在没有数据时执行 else 命令或异常。但这不起作用。请帮助我正确的语法或解决方法谢谢!
begin
--looping
for i in (
select x, y, z, rownum
from period
where x = 0 -- here this query does not return a row
) loop
begin
if sql%rowcount >=1 -- tried row count
then
dbms_output.put_line ('blablabla');
else
dbms_output.put_line ('blueeeeeee');
end if;
exception when no_data_found --tried this exception
then
dbms_output.put_line ('black');
end;
end loop;
end;
【问题讨论】:
标签: sql oracle plsql oracle11g oracle19c