What is the implication of the above command?

Examine the following command:
SQL>ALTER SESSION
SET plsql_warnings *
‘enable: severe’,
‘enable: performance’,
‘ERROR: 05003’;
What is the implication of the above command?

Examine the following command:
SQL>ALTER SESSION
SET plsql_warnings *
‘enable: severe’,
‘enable: performance’,
‘ERROR: 05003’;
What is the implication of the above command?

A.
It issues a warning whenever ERROR: 05003 occur during compilation.

B.
It causes the compilation to fail whenever the warning ERROR.05003 occurs.

C.
It issues warnings whenever the code causes an unexpected action or wrong results
performance problems.

D.
It causes the compilation to fail whenever the code gives wrong results or contains statements
that are never executed.



Leave a Reply 17

Your email address will not be published. Required fields are marked *


piero

piero

C ?
C and B seem logically right , togethet,
because doesn’t exixst WARNING ERROR: 05003 ………
but instead exists a warning that is plw-05003 that become error pls-05003
? for this reason I thoght B was wrong , explicity written to fall in error check,
and so i chosed C
again
C is otherwise equally logical right as B isn’t it ?
please, give me your opinion…..to [email protected]

pl/sql rules

pl/sql rules

https://community.oracle.com/thread/2613080?start=0&tstart=0

SQL> ALTER SESSION SET plsql_warnings = ‘enable:severe’,’enable:performance’;

Session altered.

SQL> create function unreachable
2 return varchar2
3 as
4 i_am_unreachable varchar2(1);
5 begin
6 return ‘Y’;
7 i_am_unreachable := ‘Y’;
8 end;
9 /

SP2-0806: Function created with compilation warnings

SQL> sho err
Errors for FUNCTION UNREACHABLE:

LINE/COL ERROR
——– —————————————————————–
1/1 PLW-05018: unit UNREACHABLE omitted optional AUTHID clause;
default value DEFINER used

SQL> ALTER SESSION SET plsql_warnings = ‘enable:severe’,’enable:performance’, ‘ERROR:06002’;

Session altered.

SQL> create or replace function unreachable
2 return varchar2
3 as
4 i_am_unreachable varchar2(1);
5 begin
6 return ‘Y’;
7 i_am_unreachable := ‘Y’;
8 end;
9 /

Warning: Function created with compilation errors.

SQL> sho err
Errors for FUNCTION UNREACHABLE:

LINE/COL ERROR
——– —————————————————————–
1/1 PLW-05018: unit UNREACHABLE omitted optional AUTHID clause;
default value DEFINER used

7/2 PLS-06002: Unreachable code
SQL>

pl/sql rules

pl/sql rules

it is B, you’ll get a compilation error, instead of a warning, your object will not compile:

Divyank

Divyank

Hey guys,
Are you sure answer is B? Is it tested somewhere?Please rep

Vitaly

Vitaly

http://docs.oracle.com/cd/B19306_01/appdev.102/b14261/errors.htm#sthref2093

You can also treat particular messages as errors instead of warnings. For example, if you know that the warning message PLW-05003 represents a serious problem in your code, including ‘ERROR:05003’ in the PLSQL_WARNINGS setting makes that condition trigger an error message (PLS_05003) instead of a warning message. An error message causes the compilation to fail.

User

User

PLSQL_WARNINGS enables or disables the reporting of warning messages by the PL/SQL compiler, and specifies which warning messages to show as errors.

value_clause

Multiple value clauses may be specified, enclosed in quotes and separated by commas. Each value clause is composed of a qualifier, a colon (:), and a modifier.

Qualifier values:

ENABLE

Enable a specific warning or a set of warnings

DISABLE

Disable a specific warning or a set of warnings

ERROR

Treat a specific warning or a set of warnings as errors

Modifier values:

ALL

Apply the qualifier to all warning messages

SEVERE

Apply the qualifier to only those warning messages in the SEVERE category

INFORMATIONAL

Apply the qualifier to only those warning messages in the INFORMATIONAL category

PERFORMANCE

Apply the qualifier to only those warning messages in the PERFORMANCE category

Alisa

Alisa

You can also treat particular messages as errors instead of warnings. For example, if you know that the warning message PLW-05003 represents a serious problem in your code, including ‘ERROR:05003’ in the PLSQL_WARNINGS setting makes that condition trigger an error message (PLS_05003) instead of a warning message. An error message causes the compilation to fail.

Sravz

Sravz

What is the actual ans ?

As per oracle docs I assume it is B option but still want to make sure it is correct.

Cristian

Cristian

Why isn’t the answer A? Please explain.

CREATE OR REPLACE PACKAGE package_test
AS
PROCEDURE aduna_numere(
p_n1 IN NUMBER,
p_n2 IN OUT NOCOPY NUMBER );
END;

CREATE OR REPLACE PACKAGE body package_test
AS
PROCEDURE aduna_numere(
p_n1 IN NUMBER,
p_n2 IN OUT NUMBER)
IS
BEGIN
dbms_output.put_line(‘blabla’);
END aduna_numere;
BEGIN
NULL;
END;

It compiles successfully without any errors or warnings.

After I run the following command,

ALTER SESSION
SET plsql_warnings = ‘enable: severe’, ‘enable: performance’, ‘ERROR: 05003’;

I get this warning:

Warning(3,41): PLW-05000: mismatch in NOCOPY qualification between specification and body

Himaja

Himaja

Answer is B and not C because when SEVERE and PERFORMANCE is Enabled, it issues Error instead of warnings “Whenever the code causes an unexpected action or wrong results
performance problems”