Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Compilation Warning

813048Dec 14 2013 — edited Dec 17 2013

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.

This post has been answered by Hoek on Dec 17 2013
Jump to Answer

Comments

Ramin Hashimzadeh

Read Study Guide for

1Z0-144: Oracle Database 11g:Program with PL/SQL

Handling PL/SQL Errors

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.

----

Ramin Hashimzade


MartijnBos

Why are you asking?

If I were you, I would just try out, and see wat happen.

813048

Thanks for your reply.

I dont know how to test this scenario.Can you tell me the codes how to try/test the same.

MartijnBos

Have a look at this page from the doumentation.

(search for severe)

Then you can create your on test-code.

813048

Which document?

Hoek

This:

Oracle Database Online Documentation 11g Release 2 (11.2)

(use the search box)

the 2-Day Developers Guide would be a good starting point to explore: Contents along with the SQL reference: Contents

813048

I am not able to find the answer from the document.

Can you tell me what will be the answer for this and why(reason)?

Waiting for your help.

Hoek

This should clear things up for you:

PLSQL_WARNINGS

PLW-05000 to PLW-07206

813048

Hello Hoek,

From your ref. document what i understand answer will be-

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


Am i correct?

INRi

yes you are correct..whenever you will get performance issue it issues warnings with error msg  05003.

Hoek

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

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>

Message was edited by: Hoek I just noticed: Ramin already pointed this out in the first reply you got on your thread. Hope it is all 100% clear now.

Hoek
Answer

No, that is not correct.

It will turn WARNING 5003 into an ERROR, causing compliation to fail instead of succeed. And it has totally nothing to do with performance.

Marked as Answer by 813048 · Sep 27 2020
1 - 12
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Jan 14 2014
Added on Dec 14 2013
12 comments
2,644 views