Re: Error handling



devjnr@xxxxxxxxx wrote:
I'm trying to handle exception inside a loop, but I should continue
with the loop after handle the exception:


------------------------------------------------
declare
excTest exception;
lvIdx pls_integer;
begin

lvIdx := 5;

while (lvIdx < 10)
loop

dbms_output.put_line(lvIdx);
raise excTest;
lvIdx := lvIdx + 1;

end loop;

exception

when excTest then

begin
dbms_output.put_line('1) exception');
end;

when others then

begin
dbms_output.put_line('2) unhandled exception');
end;

end;
------------------------------------------------


The problem is that I would loop until "lvIdx" is < 10....

I think it should be possible....or not?

Thx.

BEGIN
LOOP
BEGIN
--processing here
EXCEPTION
WHEN ....
-- handle exception here
END
END LOOP
END;

HTH
--
Puget Sound Oracle Users Group
.



Relevant Pages

  • Re: Error handling
    ... with the loop after handle the exception: ... excTest exception; ... lvIdx pls_integer; ...
    (comp.databases.oracle.server)
  • Error handling
    ... I'm trying to handle exception inside a loop, ... excTest exception; ... lvIdx pls_integer; ...
    (comp.databases.oracle.server)
  • Re: long double versions of functions in gcc under Cygwin
    ... rather than the nearest enclosing one) and a decent exception ... them it doesn't seem like goto usage would be affected ... int typfun() ... Why use a for loop when it is just a while loop in disguise? ...
    (comp.lang.c)
  • Re: CInternetSession
    ... the presence of the Sleepindicates the serious design flaw. ... Sleep() calls around like pixie dust, your design is fundamentally broken and will need to ... If you use Sleepin a loop, your design is probably wrong and needs to be ... The "First Chance Exception" message usually indicates nothing harmful. ...
    (microsoft.public.vc.mfc)
  • Re: Get_Line problem (GNAT bug?)
    ... Now, if the program specs says: "read the lines from input until EOF", then this for me immediately translates into a loop with some exit condition. ... "Read until" - you have a regular end-of-sequence condition here. ... I'm not convinced that exception might be a correct design choice for breaking the loop that reads data from well formatted file. ...
    (comp.lang.ada)