I am wondering why I get following CURSOR violations on the simple code example below:
- three times “Cursor - Ensure that any local cursors you are referencing have actually been opened”
- once “Cursor - Confirm that the cursor you are referencing has been opened”
CREATE OR REPLACE PACKAGE BODY PKG_TEST
SELECT 1 FROM DUAL;
val_i NUMBER (10);
IF NOT cursor1%ISOPEN
LOOP FETCH cursor1 INTO val_i; IF cursor1%NOTFOUND THEN CLOSE cursor1; EXIT; END IF; /* ... some further code ... */ END LOOP;
Can anybody help me figuring out this?
IMHO it is necessary to ask here if the cursor is already opened due to its declarations in package scope and the possible exception for opening an already open cursor.
For sure one can fix this situation if the cursor is moved to procedure scope but that is not possible because it is reused at another place (this short example just does not contain this).
I am using Toad 22.214.171.124 …
I very much appreciate your help, thank you.