When cursor parameter is used in two cursors, it is not reported as never used

Claus Pedersen

Member³
I have the following code with two cursors:
Code:
CREATE OR REPLACE PROCEDURE tester IS

  CURSOR emp1 (ename VARCHAR2,
               job   VARCHAR2)IS
    SELECT * FROM emp;

  CURSOR emp2 (job VARCHAR2)IS
    SELECT * FROM emp;

BEGIN
  OPEN emp1 ('SMITH', 'CLERK');
  OPEN emp2 ('CLERK');
END tester;
When compiled, the compiler hint says that:
Parameter 'ename' is declared but never used in 'tester'

But the parameter 'job' is unused in both cursors and should also be reported.

If the cursor emp2 and the code line using it is removed (or parameter 'job' renamed into 'job2' in cursor emp2) and compiled again, the hint correctly reports that both 'ename' and 'job' (and job2) are unused.

The reason for this error probably lies in the fact that the cursor parameter job is highlighted in both cursors when using syntax highlight. It seems that PLD recognises the cursor parameters as parameters to the 'tester' method and not as parameters for the cursors.

The correct hint text should have been:
Parameter 'ename' is declared but never used in 'emp1'

Please also refer to the post Syntax highlight bug: too many instances of parameter/variable are highlighted when having same name that addresses the same issue, but with syntax highlight (should have been fixed in 2010 :confused:)
 
Back
Top