infinite loop procedure
danielkMar 8 2011 — edited Mar 9 2011I'm trying to create an infinite loop to test an error situation. I'm doing this in stored procedure. I've not created a stored procedure before. I keep getting errors when I write the script. Can you please tell me what I'm doing wrong with this script?
Oracle 9i
<code>
CREATE OR REPLACE PROCEDURE blah.test_timeout
IS
deadline_days number :=1;
grace_period number :=0;
BEGIN
-- get the deadline days
WHILE deadline_days < 4000
LOOP
grace_period := grace_period+1;
dbms_output.put_line ('hi mom');
END LOOP;
RAISE_APPLICATION_ERROR(-20071,'what_error Error:' || sqlerrm(sqlcode));
END;
/
</code>
Error is "PLS-00103: Encountered the symbol "BEGIN" when expecting one of the following:
( ; is with authid as cluster compress order using compiled"
If I remove the "while" line, it runs without error, but it doesn't act like an infinite loop, finishing in seconds. I need it to timeout.
thanks!