I am currently running TOAD 2026R2, though the problem already occured in 2026R1.
When a statement contains an inline CASE-construct, such as in
return case when .... then...
when ...: then...
else ... end;
the next higher folding level captures too much, as you can see in the following examples, in which I wanted to fold the code of procedure chk_1p1() :

However this only happens, if the CASE-statement is in-line, for example in a procedure-call or only part of a statement. If, on the other hand, the CASE statement stands on its own—as in the following example, where the CASE statement ends with “END CASE”—the folding works as expected.
I saw that this issue was posted 11 years ago, but I can't tell if it was resolved back then or if the problem has simply resurfaced since then.
In any case, the code I'm currently reviewing contains a lot of these inline statements, and because of the error, I'm unable to use the folding functions as usual.


