SQL> create or replace function cal(a int,b int) return int is
2 c int;
3 begin
4 c:=a/b;
5 return c;
6 exception
7 when zero_divide then
8 dbms_output.put_line('wrong');
9 return -1;
10 end;
11 /函数已创建。
SQL> set serveroutput on
SQL> declare
2 i int;
3 begin
4 i:=cal(5,0);
5 end;
6 /
wrongPL/SQL 过程已成功完成。SQL>
2 c int;
3 begin
4 c:=a/b;
5 return c;
6 exception
7 when zero_divide then
8 dbms_output.put_line('wrong');
9 return -1;
10 end;
11 /函数已创建。
SQL> set serveroutput on
SQL> declare
2 i int;
3 begin
4 i:=cal(5,0);
5 end;
6 /
wrongPL/SQL 过程已成功完成。SQL>
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货