False positives for Rule 6405: Avoid defining variables that are not referenced inside the program

Global package variables/constants are marked with this error even though they are used.

CREATE OR REPLACE PACKAGE BODY toad_test
AS
  CURSOR cur_pick_line IS ( SELECT * FROM dual );  --> Rule 6405
  c_test CONSTANT PLS_INTEGER := 1;  --> Rule 6405
  g_test PLS_INTEGER;  --> Rule 6405
BEGIN
  OPEN cur_pick_line;
  CLOSE cur_pick_line;
  dbms_output.put_line( c_test );
  g_test := g_test + 1;
END toad_test;

Hi Peter,

I'm not able to reproduce this issue locally here. For me, Rule 6405 is not triggered for the code you provided.

Have you tried Andre's solution provided in the following thread?

Thanks,

-John

John, Peter sure did. With the latest code I'm getting identical results.
The problem is that there seems to be an inconsistency in parse info between procedure and package body, by which I got trapped. If you change CREATE OR REPLACE PACKAGE BODY by C O R PROCEDURE then it'll work.

Let me look into this.

Andre