Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

infinite loop procedure

danielkMar 8 2011 — edited Mar 9 2011
I'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!
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 6 2011
Added on Mar 8 2011
13 comments
2,740 views