Smarter than PL/SQL Compiler? Test Yourself - PLW-5005


Do you think you are smarter than PL/SQL compiler ?

What's wrong

What's wrong

Now take a look at above code and find out what's wrong with the code.

After your analysis, you have decided what's wrong with code, let's find out what PL/SQL compiler will tell us.

I am going to enable warning in my SESSION using below code

    ALTER SESSION SET plsql_warnings = 'enable:all'

Now this one will not only give compiler error but also feedback how can I improve my function.
So I compile the function and I get some interesting feedback

[Warning] PLW-05005:subprogram WHATS_WRONG returns without value at line 21.

Now line 21 is the last line of the function, so its not actually telling where in function there is a gap in the logic, it simply telling me that by the time I am at line 21, there is a possibility that a return statement may not be executed. So I get a function returns without value.

Now you probably have figured it out that there a return at line 13 and at line 16 but there is no return at line 18.
In the simple program it's not hard to find this but in a real code with hundreds of thousands of lines it can be very difficult to sort it out.

So in this case compile time warning system tells me automatically if I have my warnings enabled.
Did you sort it out ? I hope you did. If not or in any case I encourage you to automatically turn on warnings in SQL developer.

If you like and would like to contribute, you can also write your article here or mail your article to . See your article appearing on the main page and help others to learn.

Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.

Python if , elif and else

Python Conditions and If statements

  • 0
Python for beginners

Learning Python Part 1

  • 3
Struct Alignment and Padding

Struct Alignment and Padding in C++ And C

  • 0
Friend function

Friend function C++

  • 0

C++ Pointers

  • 0

C++ Structures

  • 0
Types of Inheritance in C++

Inheritance and access specifiers C++

  • 0
Java date pattern

Java Date Pattern Syntax

  • 0
Java Date and Calendar

Java Date formats

  • 0
JAVA Data Type

Data types in Java

  • 0
Java unreachable code

Unreachable Code Error in Java

  • 0

Post Comment





Forgot Password

Please enter your email address below and we will send you information to change your password.