v_test is not a constant:
CREATE OR REPLACE PROCEDURE toad_test AS
TYPE test_type IS RECORD(
field PLS_INTEGER
);
v_test test_type; – Rule 2131
BEGIN
v_test.field := 1;
END;
v_test is not a constant:
CREATE OR REPLACE PROCEDURE toad_test AS
TYPE test_type IS RECORD(
field PLS_INTEGER
);
v_test test_type; – Rule 2131
BEGIN
v_test.field := 1;
END;
Does the following work better?
//VAR_DECL [not(…//ASSIGN/LHS/QNAME/IDENTIFIER[1]/@value = QNAME/@value)]
[not(…//INTO_LIST/QNAME/IDENTIFIER[1]/@value = QNAME/@value)]
[not(…//PARAM/QNAME/IDENTIFIER[1]/@value = QNAME/@value)]
/QNAME
Here we look for variables as the leftmost symbol in dotted series of symbols which never get data assigned.
Andre
It works as expected for the cases I tested. Thanks!
This does not trigger the rule any more (correct):
v_test.field := 1;
This still triggers the rule (correct):
IF( v_test.field = 1 ) THEN
NULL;
END IF;
Old rule for reference:
//VAR_DECL [not(…//ASSIGN/LHS/QNAME/@value = QNAME/@value)]
[not(…//INTO_LIST/QNAME/@value = QNAME/@value)]
[not(…//PARAM/QNAME/@value = QNAME/@value)]
/QNAME
Thanks Peter for your testing effort. I’ll add the new expression to the Toad rule universe.
Andre