PL/SQL Exit

Oracle PL/SQL Exit Example

DECLARE
	v_name customers.customer_name%TYPE; 
	v_type customers.customer_type%TYPE; 
	CURSOR c IS 
		SELECT customer_name, customer_type 
		FROM customers
		WHERE customer_id = 2147;
BEGIN
	OPEN c; 
	LOOP
		FETCH c INTO v_name, v_type; 
		EXIT WHEN c%NOTFOUND;
		DBMS_OUTPUT.PUT_LINE ('Description: '||v_name||' '||v_type||'');
	END LOOP;
	CLOSE c;
END;