17,086
社区成员
发帖
与我相关
我的任务
分享
create or replace procedure test_proc
as
v_number number:=0;
begin
for i in 1..100 loop
begin
select num into v_number from tab_test where id=to_char(i);
exception
when no_data_found then
null;--有异常时,什么也不执行
end;
end loop;
end test_proc;
SQL> set serveroutput on;
SQL> declare
2 begin
3 for i in 1..10 loop
4 if mod(i,2)=0 then
5 goto next;
6 end if;
7 dbms_output.put_line(i);
8 <<next>>
9 null;
10 end loop;
11 end;
12 /
1
3
5
7
9
PL/SQL 过程已成功完成。
SQL>