Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Infinite loops possible in PL/SQL?
In article <3929B7F8.F7EDC038_at_yahoo.com>,
Shmooth <shmooth_at_yahoo.com> wrote:
> I'm trying to produce an infinite loop using PL/SQL. Is this
possible?
>
> I'm studying for my OCP exam and my book mentions how I should do
> different things to avoid these dastardly loops that can be cause when
> an exception handler throws another exception.
>
> Example that does *not* loop infinitely:
> -----------------------------------------------
> DECLARE
> status NUMERIC;
> num NUMERIC;
> BEGIN
> DBMS_OUTPUT.put_line('Beginning test...');
> num := 1/0; -- throw 1st exception
> DBMS_OUTPUT.put_line('Test successful...');
> EXCEPTION
> WHEN OTHERS THEN
> BEGIN
> status := SQLCODE;
> num := 2/0; -- throw nested exception
> END;
> END;
>
>
Just do
LOOP <loop body>
END LOOP; In Ada/PLSQL syntax loop statement without conditions produces infinite loop.
Alex Filonov.
Sent via Deja.com http://www.deja.com/
Before you buy.
Received on Fri May 26 2000 - 00:00:00 CDT
![]() |
![]() |