PL/SQL 语言 一
Declare
a Varchar2(20);
b Number(10);
c Number(10);
m Number(5);
sname Varchar2(20);
nozero Exception;
Begin
a := '小明';
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>0
Loop
dbms_output.put_line(m);
m := m-1;
End Loop; */
/* For n In 1..5
Loop
dbms_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 Then
Dbms_Output.Put_Line('没有查询到数据'); */
If b=0 Or c=0 Then
Raise nozero;
End If;
If b > c Then
Dbms_Output.Put_Line('b大于c');
Elsif b < c Then
Dbms_Output.Put_Line('b小于c');
Else
Dbms_Output.Put_Line('b等于c');
End If;
Exception
When nozero Then
dbms_output.put_line('b和c都不能为0!');
When Others Then
dbms_output.put_line('其他异常!');
End;