Pages

Tuesday, December 16, 2014

PL/SQL Reference IV - Compilation Errors and Warnings

===========================================
Compilation Errors and Warnings Index
===========================================
How to see Compilation Errors
Control Warnings
Special PLW error codes
DBMS_WARNING Package




===========================================
How to Compile a Procedure
===========================================
To compile a procedure:
ALTER PROCEDURE my_proc COMPILE PLSQL_WARNING='ENABLE:ALL';

===========================================
How to see Compilation Errors
===========================================
Oracle stores compilation errors and warnings in USER_ERRORS table.

Use sho err (show errors) to see compilation errors and warnings


===========================================
Control Warnings
===========================================
PL/SQL Warning categories
PLSQL_WARNING parameters controls the warnings raised.
There are four possible values for PLSQL_WARNING parameter:
SEVERE
PERFORMANCE

INFORMATION
ALL - all warning messages.

PLSQL_WARNING parameter
This parameter can be set at system/session level.
For example:
ALTER SESSION SET PLSQL_WARNING='ENABLE:ALL'
ALTER SESSION SET PLSQL_WARNING ='DISABLE:INFORMATION';
ALTER SESSION SET PLSQL_WARNING='ENABLE:SEVERE';
ALTER SESSION SET PLSQL_WARNINGS='DISABLE:07204';

ERROR:07204 - Is example of how to ignore a PLW-07204 error.

===========================================
Special PLW error codes
===========================================
PLW-06009: procedure "MY_PROC" OTHERS handler does not end in
         RAISE or RAISE_APPLICATION_ERROR.
This means that exceptions are not being raised out the procedure.

===========================================
DBMS_WARNING Package
===========================================
DBMS_WARNING is for handling PL/SQL warnings.


Usage examples
DBMS_WARNING.set_warning_setting_string('ENABLE:ALL','SESSION');

SELECT DBMS_WARNING.get_warning_setting_string() FROM DUAL;

No comments:

Post a Comment