Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Infinite loops possible in PL/SQL?

Re: Infinite loops possible in PL/SQL?

From: Marc <E.Mail_at_address.com>
Date: 2000/05/24
Message-ID: <8gg25h$jl6$1@vkhdsu24.hda.hydro.com>#1/1

And if you want to crash the server (at least with Oracle 7.3.4 on Windows NT), try this:

create or replace function f_endless
as
begin
  f_endless;
end;
/

and execute the function (although I suggest not to execute it...)

ps : is there someone who has already found a solution for this problem that eats up memory until nothing is left ?

Marc

Brian Peasland wrote in message <392A8865.232F9CCC_at_edcmail.cr.usgs.gov>...
>Why not? Try:
>
>DECLARE
> vNum NUMBER;
>BEGIN
> vNum := 1;
> WHILE vNum > 0 LOOP
> vNum := 1;
> END LOOP;
>END;
>
>HTH,
>Brian
>
>Shmooth 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;
>
>--
>========================================
>Brian Peasland
>Raytheons Systems at
> USGS EROS Data Center
>These opinions are my own and do not
>necessarily reflect the opinions of my
>company!
>========================================
Received on Wed May 24 2000 - 00:00:00 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US