日期:2014-05-16 浏览次数:20465 次
[DECLARE declaration_statements ] BEGIN executable_statements [EXCEPTION exception_handling_statements ] END
declare
width integer;
height integer := 2;
area integer;
begin
area := 6;
width := area/height;
dbms_output.put_line('width = '||width);
exception
when zero_divide then dbms_output.put_line('除数为0');
end;
/
SQL> declare
  2  width integer;
  3  height integer := 2;
  4  area integer;
  5  begin
  6  area := 6;
  7  width := area/height;
  8  dbms_output.put_line('width = '||width);
  9  exception
 10  when zero_divide then dbms_output.put_line('除数为0');
 11  end;
 12  
 13  /
width = 3
PL/SQL procedure successfully completed