Toad World® Forums

Strange error with Codexpert

Strange error with Codexpert

I don’t think it is so strange. Why would you check for an open cursor and then try to open it again?

I must admin I have not coded it and I am also no big expert of pl/sql.
But I understand the idea is to check first if the cursor is already open, and only if NOT then open it. to avoid opening an already open cursor.

I have seen there was a copy past error.
The code is like this

if NOT c1%ISOPEN then
open c1 (name);
end if;

Can you let me know what Rules are being triggered (the number, not the
description)? Some of the rules may need tweaking and we can look and see if
these are in that group.



Do you mean in general or those which give me that error?
The last one, are Rules 2606 and 2608.
I am Picking up “All rules by objective”

BTW I have tried also something very simple,
like the code below, and it is also giving me the same error:


cursor cur is
select *
from dual;

if NOT cur%isopen then
  open cur;
end if;

close cur;


Question2: IS there a way for me to see the “source code” definition of those rules, i.e. what it is checking?


That explains it. 2606 and 2608 are based on the old rule structure and are in
the process of being converted to the new engine so the logic in them needs work
and should be correct once they’re converted. In the mean time, you could make
your own rule set that doesn’t have those rules in it.


Hi Greg,
Thanks for the explanation.
Any Advice on when the new engine with the new rules will be available?


The new engine is already in place. If you look at the rules, any rule that is
editable (has an XPath query) is using the new engine. The rest are still in the
process of being converted. Hopefully we’ll have them all converted for the 11.1
release in the spring. In addition, we’ll have a mechanism for creating your own
rules with the next release. I’ve got a meeting with the Code Analysis team this
morning and we have several things on the agenda but I’ll make sure to bring up
these rules.


Thanks a lot Greg !