Skip to Main Content
  • Questions
  • PLSQL_WARNINGS parameter doesn't stick

Breadcrumb

Question and Answer

Chris Saxon

Thanks for the question, Dexter.

Asked: February 02, 2023 - 2:35 pm UTC

Last updated: February 03, 2023 - 11:45 am UTC

Version: 19.3

Viewed 1000+ times

You Asked

I'm an 'accidental' DBA that's also been tasked with PL/SQL development work.
Ours is a small environment; I'm the only DBA plus another developer who is completely new to PL/SQL.

I'm working (development environment) on a basic package and after getting some compilation errors, I discovered the PLSQL_WARNINGS parameter and found it was set to:

NAME           TYPE   VALUE                                                    
-------------- ------ -------------------------------------------------------- 
plsql_warnings string ERROR:INFORMATIONAL, DISABLE:PERFORMANCE, DISABLE:SEVERE 


Not quite what we want, so I ran this in SQL*Plus as SYS:

ALTER SYSTEM SET PLSQL_WARNINGS = 'ENABLE:ALL' SCOPE=BOTH;


which returned:

System SET altered.


To confirm it:

show parameter PLSQL_WARNINGS;


returned:

NAME           TYPE   VALUE      
-------------- ------ ---------- 
plsql_warnings string ENABLE:ALL 


So far, so good. Later that day I was demonstrating this setting to my boss and the settings had reverted back to the previous values.

This was not only awkward, but confusing as well. MOS tells me there is no known bug or other explanation for this behavior. The system is not getting restarted and the developer does not have privileges to change this parameter.

What gives?

and Chris said...

You can set the warnings at the system and session level.

When you use show parameter, you'll get the current session settings. Query v$parameter itself to find the system settings:

show parameter plsql_warnings;
/*
NAME           TYPE   VALUE                                                     
-------------- ------ --------------------------------------------------------- 
plsql_warnings string DISABLE:INFORMATIONAL, ENABLE:PERFORMANCE, DISABLE:SEVERE
*/

alter session set plsql_warnings = 'enable:all';

show parameter plsql_warnings;
/*
NAME           TYPE   VALUE      
-------------- ------ ---------- 
plsql_warnings string ENABLE:ALL 
*/

select value 
from   v$parameter
where  name = 'plsql_warnings';
/*
VALUE                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
---------------------------------------------------------
DISABLE:INFORMATIONAL, ENABLE:PERFORMANCE, DISABLE:SEVERE
*/


So you may have a login script that sets this for your sessions.

Check the COMPILE REUSE SETTINGS clause if you want to preserve the warning level you used when compiling a PL/SQL unit. Steven Feuerstein digs into the details of this at

https://stevenfeuersteinonplsql.blogspot.com/2018/09/all-about-plsql-compilation-settings.html

Is this answer out of date? If it is, please let us know via a Comment

More to Explore

PL/SQL demos

Check out more PL/SQL tutorials on our LiveSQL tool.

PL/SQL docs

PL/SQL reference manual from the Oracle documentation library