Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> PLS-06002: Unreachable code

PLS-06002: Unreachable code

From: Martin <martin.j.evans_at_gmail.com>
Date: 24 Oct 2006 12:03:36 -0700
Message-ID: <1161716616.092099.210670@b28g2000cwb.googlegroups.com>


I can see a number of people have hit PLS-06002: Unreachable code but even though I've read those posts I cannot see a way through this.

When I compile the following procedure (with default options) I get:

Errors for PACKAGE BODY xxx:
LINE/COL ERROR




nnn/13 PLS-06002: Unreachable code

When I set alter session set PLSQL_OPTIMIZE_LEVEL=0; it makes no difference.
When I set ALTER SESSION SET PLSQL_WARNINGS='DISABLE:PERFORMANCE'; it goes away but I'd rather find the solution. I've reduced the offending procedure to this:

PROCEDURE xxx (

        x varchar2) as
  l_idx pls_integer;
  mbid varchar2(50);
  mb_list varchar2(1000);
  BEGIN

      mb_list := x;
        LOOP
          l_idx := instr(mb_list, ',');
          IF (l_idx <> 0) THEN
              mbid := substr(mb_list,1,l_idx-1);
              mb_list := substr(mb_list,l_idx+1);
          ELSE
            mbid := mb_list;
          END IF;
	  dbms_output.put_line(mbid);
          IF l_idx = 0 THEN
            EXIT;
          END IF;
        END LOOP;

  END; When I compile it with ALTER SESSION SET PLSQL_WARNINGS='DISABLE:PERFORMANCE'; and run it with an argument of 'a,b,c' I correctly get the output:

a
b
c

so it appears it works - so why the PLS-06002? and why does it error?

This is 10.2.0 XE on linux.

Martin Received on Tue Oct 24 2006 - 14:03:36 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US