Declarea Varchar2(20);b Number(10);c Number(10);m Number(5);sname Varchar2(20);nozero Exception;Begina := '小明';Dbms_Output.Put_Line(a);b := 3;c := 0;/* 循环 */
/* m :=50;Loop Exit When m<0;dbms_output.put_line(m);m := m-1;End Loop; *//* While m>0Loopdbms_output.put_line(m);m := m-1;End Loop; *//* For n In 1..5 Loopdbms_output.put_line(n);End Loop; *//* Select s.Name Into Sname From z_Student s Where s.Id = m;Dbms_Output.Put_Line('查询结果:' || Sname);Exception When No_Data_Found ThenDbms_Output.Put_Line('没有查询到数据'); */If b=0 Or c=0 ThenRaise nozero;End If;If b > c ThenDbms_Output.Put_Line('b大于c');Elsif b < c ThenDbms_Output.Put_Line('b小于c');ElseDbms_Output.Put_Line('b等于c');End If;ExceptionWhen nozero Then dbms_output.put_line('b和c都不能为0!'); When Others Thendbms_output.put_line('其他异常!');End;