Question: How does the PL/SQL show errors
command work?
Answer: When you run
PL/SQL the code is interpreted at runtime, and you may see these
types of errors:
- Syntax errors: These are indicated
by the "Warning: Procedure created with compilation errors" message.
You can display the error with the "show errors" SQL*Plus command).
- Semantic errors: These are invalid table or column names.
- Run time errors: This is a a non-zero Oracle database
error code.
For more details, see my notes on
PL/SQL debugging techniques.
Show errors command
To see PL/SQL interpreter errors, you can use the SQL*Plus "show
errors" command: as seen in the "show errors" example
SQL> create or
replace procedure example_defaults
2 (n_1
in number := 5,
3 n_2 in number :=
6,
4 n_3 in number := 7)
5 as
6 begin
7 n_1
:= n_2 + n_3;
8 end;
9 /
Warning: Procedure
created with compilation errors.
SQL> show errors
Errors for
PROCEDURE EXAMPLE_DEFAULTS:
LINE/COL ERROR
-------- ------------------------------------------------
PLS-00363: expression 'N_1' cannot be used as an assignment target
For enhanced show errors command feedback, you can join into
dba_errors and dba_source and see the feedback lines
in the PL/SQL source code:
set lines 100
set
pages 100
column
text format a100
with err as (
select distinct
owner,
name,
type,
line,
position,
sequence,
text
from
dba_errors
where
sequence=1
)
select
decode(n,-1,'* ','
')||text text from (
select
sequence n,
owner,name,
type,line,
lpad('
',position-1,' ')||'^'||text text
from
err
union all
select
distinct
-1 n,
owner,
name,
type,
line,
type||' '||owner||'.'||name||' line '||line
from
err
union all
select
0,
owner,
name,
type,
line,
text
from
dba_source
where
(owner,name,type,line)
in
(select
owner,
name,
type,
line
from
err)
order by
owner,name,
type,line,
n
);
|
|
|
Oracle Training from Don Burleson
The best on site
"Oracle
training classes" are just a phone call away! You can get personalized Oracle training by Donald Burleson, right at your shop!

|
|
|
|
|
Burleson is the American Team

Note:
This Oracle
documentation was created as a support and Oracle training reference for use by our
DBA performance tuning consulting professionals.
Feel free to ask questions on our
Oracle forum.
Verify
experience!
Anyone
considering using the services of an Oracle support expert should
independently investigate their credentials and experience, and not rely on
advertisements and self-proclaimed expertise. All legitimate Oracle experts
publish
their Oracle
qualifications.
Errata?
Oracle technology is changing and we
strive to update our BC Oracle support information. If you find an error
or have a suggestion for improving our content, we would appreciate your
feedback. Just
e-mail:
and include the URL for the page.
Copyright © 1996 - 2020
All rights reserved by
Burleson
Oracle ®
is the registered trademark of Oracle Corporation.
|
|