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!

Want to show all Unreachable Code in a PL/SQL code

AChatterjeeApr 18 2011 — edited Apr 19 2011
I have one function and there are 2 lines (Line no 8 and 11) that will never be reached (Dead Code).
But in warnings it is showing only line no 8. I want to show all unreachable line of code at a time.

Is there any way to reach this ?
SQL> ALTER SESSION SET PLSQL_WARNINGS='ENABLE:ALL';

Session altered.

SQL> CREATE OR REPLACE FUNCTION xx_test_function RETURN NUMBER 
  2  IS
  3  x NUMBER := 10;
  4  BEGIN
  5    IF x = 10 THEN
  6      x := 20;
  7    ELSE            
  8      x := 100;    -- dead code (never reached)
  9    END IF;
 10    RETURN x;
 11    dbms_output.put_line('Pint the value '||x); -- dead code (never reached)
 12  END;
 13  /

SP2-0806: Function created with compilation warnings

SQL> show err
Errors for FUNCTION XX_TEST_FUNCTION:

LINE/COL ERROR
-------- -----------------------------------------------------------------
8/5      PLW-06002: Message 6002 not found; No message file for
         product=plsql, facility=PLW
Edited by: AChatterjee on Apr 18, 2011 9:17 AM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 17 2011
Added on Apr 18 2011
8 comments
605 views