Bug: hint "Value assigned to ... never used in ..." is not reported when before IF .. ELSE .. END IF

Claus Pedersen

Member³
I have the following code:
Code:
PROCEDURE test IS
  i INT;
BEGIN
  i := 1;

  IF 2=3 THEN
    i := 4;
  ELSE
    i := 5;
  END IF;

  IF i=6 THEN
    NULL;
  END IF;
END;

PL/SQL developer does not report the first assignment i := 1 to be unused because the assignments i:=4 and i:=5 is inside an IF-ELSE statement. If the three lines with the comparison i=6 are removed, all three assignments are reported as unused, so PLD knows that the first assignment is there.

A default assignment to a variable (i INT:=0) is never reported as unused. This should also be fixed.
 
Back
Top