SQL>
SQL>
SQL> set echo off
SQL> set verify off
SQL> set define '&'
SQL>
SQL> prompt 'degrees F?:'
'degrees F?:'
SQL> accept temp default '100'
SQL> declare
2 porridge_too_hot exception;
3 porridge_too_cold exception;
4 begin
5 case
6 when '&temp' < 90.00 then raise porridge_too_cold;
7 when '&temp' > 140.00 then raise porridge_too_hot;
8 else null;
9 end case;
10
11 dbms_output.put_line('just right');
12
13 exception
14 when VALUE_ERROR then
15 dbms_output.put_line('Please enter a numeric temperature (like 100)');
16
17 when porridge_too_hot then
18 dbms_output.put_line('way too hot...');
19
20 when porridge_too_cold then
21 dbms_output.put_line('way too cold...');
22 end;
23 /
just right
PL/SQL procedure successfully completed.
SQL>
|