when you use sql*plus to submit pl/sql code, and when the code contains errors, you receive notification that compilation errors have occurred, but there is no immediate indication of what the errors are. for example, if you submit a standalone (or stored) procedure proc1 in the file proc1.sql as follows:
sql> @proc1
and, if there are one or more errors in the code, then you receive a notice such as the following:
mgr-00072: warning: procedure proc1 created with compilation errors
in this case, use the show errors statement in sql*plus to get a list of the errors that were found. show errors with no argument lists the errors from the most recent compilation. you can qualify show errors using the name of a procedure, function, package, or package body:
sql> show errors proc1
sql> show errors procedure proc1
see also:
sql*plus user's guide and reference for complete information about the show errors statement
note:
before issuing the show errors statement, use the set linesize statement to get long lines on output. the value 132 is usually a good choice. for example:
set linesize 132
assume that you want to create a simple procedure that deletes records from the employee table using sql*plus:
create or replace procedure fire_emp(emp_id number) as
begin
delete from emp_tab wher empno = emp_id;
end
/
notice that the create procedure statement has two errors: the delete statement has an error (the e is absent from where), and the semicolon is missing after end.
after the create procedure statement is entered and an error is returned, a show errors statement returns the following lines:
show errors;
errors for procedure fire_emp:
line/col error
-------------- --------------------------------------------
3/27 pl/sql-00103: encountered the symbol "empno" wh. . .
5/0 pl/sql-00103: encountered the symbol "end" when . . .
2 rows selected.
show errors在调试create function/ procedure/ package时非常有用, 让我找了好几天, 要不错了就一个"mgr-00072: warning: procedure proc1 created with compilation errors"很是郁闷, 自己也不知道错在什么地方了!
ref: oracle 10.2 document
阅读(4654) | 评论(0) | 转发(0) |