Hello Rainer,
Of course a reciprocal formidable 2024 for you, and all inspired Toadies!
Yes it took me a bit to sort it out. The culprit is the XPath expression of rule 6714 which did not like a mix of WHEN clauses with simple variables (or literals) and WHEN clauses with expressions. This causes an XPath expression error which in Toad was unfortunately converted into a bogus result on line 0, column 0. So Rainer I do fully agree that you have no hidden line 0 in your code!
The same error on rule 6715 (the next rule in the list of rules to be checked) was caused by the above, a minor bug.
The ultimate fix is to have the XPath expression for rule 6714 replaced by the following corrected version:
//EXPR[@cat = "case"]/(
for $cw in ./CASE_WHEN
return
(: compare with all following siblings :)
for $fcw in $cw/following-sibling::CASE_WHEN
return $fcw[qp5:equal-tokens(child::*[1], $cw/child::*[1])]/child::*[1]
)
For now you could tweak the Rule Universe file yourself. A next Toad beta (or release) will include the fixed expression as well. Your choice.
(QP-4140)
The rest of this post details what was happening - for those who are interested only, no need to read it, or to understand things whatsoever. 
Here's some minimal code producing the bug:
BEGIN
r := CASE
WHEN x IS NOT NULL THEN y
WHEN x THEN z
ELSE NULL
END;
END;
... and matching Parse Info:
<BLOCK>
<STMT>
<ASSIGN>
<LHS>
<QNAME value="r">
<IDENTIFIER value="r" dbvalue="R" />
</QNAME>
</LHS>
<RHS>
<EXPR cat="case">
<CASE_WHEN>
<EXPR cat="is_not_null">
<QNAME value="x">
<IDENTIFIER value="x" dbvalue="X" />
</QNAME>
</EXPR>
<QNAME value="y">
<IDENTIFIER value="y" dbvalue="Y" />
</QNAME>
</CASE_WHEN>
<CASE_WHEN>
<QNAME value="x">
<IDENTIFIER value="x" dbvalue="X" />
</QNAME>
<QNAME value="z">
<IDENTIFIER value="z" dbvalue="Z" />
</QNAME>
</CASE_WHEN>
<CASE_ELSE>
<LITERAL type="boolean" value="null" dbvalue="null" />
</CASE_ELSE>
</EXPR>
</RHS>
</ASSIGN>
</STMT>
</BLOCK>
The old XPath expression ...
//EXPR[@cat = "case"]/(
for $c in ./CASE_WHEN
return
for $ci in $c/following-sibling::CASE_WHEN
return $ci[qp5:equal-tokens(EXPR, $c/EXPR)]/EXPR
)
... compares each WHEN clause with its following siblings.
In our case it uses an XPath function qp5:equal-tokens()
to compare the WHEN variable x
with the WHEN expression x IS NOT NULL
.
As you can see, in the above case the function will want to compare EXPR
children of the CASE_WHEN
elements (there's at most one EXPR
child though). The first CASE_WHEN
has EXPR
children indeed, all right, but the second one has QNAME
(qualified name) children just because there's no expression! So that caused the error.
The fix is just to compare the children regardless of what they are.
Thanks,
Andre