Index | Home | Forums
Oracle PL/SQL Example 4-8 Using an EXIT Statement

Example 4-8 Using an EXIT Statement

DECLARE
  credit_rating NUMBER := 0;
BEGIN
  LOOP
    credit_rating := credit_rating + 1;
    IF credit_rating > 3 THEN
       EXIT;  -- exit loop immediately
    END IF;
 END LOOP;
 -- control resumes here
 DBMS_OUTPUT.PUT_LINE ('Credit rating: ' || TO_CHAR(credit_rating));
 IF credit_rating > 3 THEN
       RETURN;  -- use RETURN not EXIT when outside a LOOP
 END IF;
 DBMS_OUTPUT.PUT_LINE ('Credit rating: ' || TO_CHAR(credit_rating)); 
END;
/


This page was generated on/at Feb 23,2008 00:20:12
General comments and questions regarding this document should be sent by email to info@oracleabc.com or post your comments here




Index | Home | Forums
Oracle PL/SQL Example 4-8 Using an EXIT Statement

Example 4-8 Using an EXIT Statement

DECLARE
  credit_rating NUMBER := 0;
BEGIN
  LOOP
    credit_rating := credit_rating + 1;
    IF credit_rating > 3 THEN
       EXIT;  -- exit loop immediately
    END IF;
 END LOOP;
 -- control resumes here
 DBMS_OUTPUT.PUT_LINE ('Credit rating: ' || TO_CHAR(credit_rating));
 IF credit_rating > 3 THEN
       RETURN;  -- use RETURN not EXIT when outside a LOOP
 END IF;
 DBMS_OUTPUT.PUT_LINE ('Credit rating: ' || TO_CHAR(credit_rating)); 
END;
/


This page was created by oracleabc.com on Feb 23,2008 00:09:02
General comments and questions regarding this document should be sent by email to info@oracleabc.com or post your comments here