别人学习询问我一个存储过程怎么写,我让他把存储过程发给我看看,最后修改后在SQLPLUS下的执行结果:
其中show error 会显示存储过程编译过程中的错误信息!
C:\Documents and Settings\Administrator.WUTONGHUA>sqlplus /nolog
SQL*Plus: Release 10.2.0.3.0 - Production on 星期五 4月 6 15:34:36 2012
Copyright (c) 1982, 2006, Oracle. All Rights Reserved.
SQL> conn gdsmis_jilin/gongdiansuo@orcl
已连接。
SQL> set serverout on
SQL> create or replace procedure test(x in number) is
2 a number;
3 begin
4 if x >0 then
5 begin
6 a:=0-x;
7 dbms_output.put_line(to_char(x));
8 end;
9 end if;
10 if x=0 then
11 begin
12 a:=1;
13 dbms_output.put_line(to_char(x));
14 end;
15 end if;
16
17 end;
18 /
过程已创建。
SQL>show error
SQL> exec test(2);
2
PL/SQL 过程已成功完成。
SQL>