SQL>
SQL>
SQL> DECLARE
2 d VARCHAR2(1);
3
4 no_data_found EXCEPTION;
5
6 BEGIN
7
8 SELECT 'dummy' INTO d FROM dual WHERE 1=2;
9
10 IF d IS NULL
11
12 THEN
13
14 RAISE no_data_found;
15
16 END IF;
17
18 EXCEPTION
19
20 WHEN no_data_found
21
22 THEN
23
24 DBMS_OUTPUT.PUT_LINE ('Trapped the error!?');
25 END;
26 /
DECLARE
*
ERROR at line 1:
ORA-01403: no data found
ORA-06512: at line 8
SQL>
|