I am getting incorrect "value assigned to [x] never used in [y]" hints. I have reduced one case down to the following:
I get the hint "12 value assigned to 'n2' never used in 'Foo'", but you can clearly see that the value is used when calling htp.prn(). Interestingly, there is no hint for n1. Removing the CASE expression makes the hint go away, so I'm guessing that's where the problem is.
Code:
CREATE OR REPLACE PACKAGE BadHint AS
END;
/
CREATE OR REPLACE PACKAGE BODY BadHint AS
PROCEDURE Foo IS
n1 NUMBER;
d DATE;
n2 NUMBER;
BEGIN
IF ( TO_CHAR( SYSDATE, 'yyyy' ) = '2000' ) THEN
n1 := 1;
d := SYSDATE;
n2 := 1;
ELSE
n1 := 1;
d := CASE 1 WHEN NULL THEN SYSDATE ELSE SYSDATE END;
n2 := 1;
END IF;
htp.prn(TO_CHAR(n1));
htp.prn(TO_CHAR(d));
htp.prn(TO_CHAR(n2));
END Foo;
END BadHint;
/
I get the hint "12 value assigned to 'n2' never used in 'Foo'", but you can clearly see that the value is used when calling htp.prn(). Interestingly, there is no hint for n1. Removing the CASE expression makes the hint go away, so I'm guessing that's where the problem is.