Will the implicit cursor ever close in PL / SQL?

With PL / SQL, will there ever be a situation, say, in the case of an exception, where the implicit cursor will not be closed?

I understand that the implied cursor should close after use, but I just want to know if there is ever a situation where this may not be the case, and if possible, what kind of remediation would be a good idea.

+5
source share
3 answers

When COMMIT or ROLLBACKit fails, the cursor will not automatically close.

When using cursors, it is recommended to use the route below:

-- before using the cursor
    IF your_cursor %ISOPEN THEN
         CLOSE your_cursor;
    END IF;
   OPEN your_cursor;

-- after using the cursor
         CLOSE your_cursor;
-- when exception
    IF your_cursor %ISOPEN THEN
         CLOSE your_cursor;
    END IF;
+1
source

Define an "implicit cursor" as a SELECT statement executed in a FOR loop.

- , , : " ?". , "". , ( ) , .

, . -, . , , , .. . , .

, . .:-) , , - IMO, , . , , , , . , . , , - , , , , Corporateville, , , , , , , , , . (, Oracle), , FOR-LOOP - ! ( , , : -)

.

+1

, , .. SELECT INTO... DML, PL/SQL, FOR.

, ; SQL%NOTFOUND ( CURSOR_NAME%NOTFOUND).

11.1 SQL%ISOPEN:

FALSE, SQL SQL.

, , , , , . , , - , SQL.

11.2.

SQL% ISOPEN FALSE.

, :

SQL% ISOPEN FALSE, .

, - : " ". :

, .

, . ; .

, : ORA-0100: , , , .

0
source

All Articles