Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: PLS-06002: Unreachable code
Andy Hassall wrote:
> On 24 Oct 2006 12:03:36 -0700, "Martin" <martin.j.evans_at_gmail.com> wrote:
>
> >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:
> [snip]
> > IF l_idx = 0 THEN
> > EXIT;
> > END IF;
> >
> >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:
> [snip]
> >so it appears it works - so why the PLS-06002? and why does it error?
> >
> >This is 10.2.0 XE on linux.
>
> I'm tempted to call "Oracle bug" here, particularly since it doesn't show a
> warning if you replace the conditional with the equivalent:
>
> EXIT WHEN l_idx = 0;
>
Andy,
I've seen some of your replies to similar issues in my research on
this.
Your alternative does in fact work - thanks for that.
The problem I (and a colleague) are having is that we are relatively new to oracle procedures (converting DB2 and MySQL) and writing a lot of procedures and finding we get this PLS-06002 error a lot. This was just one of many examples I could have given. Of course we are only prototyping at the moment with XE so we don't have a line to Oracle as yet. I did find some posts which suggested this warning/error changed between oracle 9 and 10 but given the number of examples we have where this happens I'm amazed there isn't more info about this on the net if it is a bug.
Thanks for the alternative anyway.
Martin Received on Tue Oct 24 2006 - 14:54:39 CDT
![]() |
![]() |