Lab 10.1 Exception Scope
Lab ObjectivesAfter this Lab, you will be able to: |
You are already familiar with the term scope—for example, the scope of a variable. Even though variables and exceptions serve different purposes, the same scope rules apply to them. Now examine the scope of an exception by means of an example.
▪ FOR EXAMPLE
DECLARE v_student_id NUMBER := &sv_student_id; v_name VARCHAR2(30); BEGIN SELECT RTRIM(first_name)||' '||RTRIM(last_name) INTO v_name FROM student WHERE student_id = v_student_id; DBMS_OUTPUT.PUT_LINE ('Student name is '||v_name); EXCEPTION WHEN NO_DATA_FOUND THEN DBMS_OUTPUT.PUT_LINE ('There is no such student'); END;
In this example, you display the student’s name on the ...
Get Oracle® PL/SQL® Interactive Workbook, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.