Closing a cursor variable, PL-SQL Programming

Closing a Cursor Variable

The CLOSE statement disables the cursor variable. After that, the related result set is undefined. The syntax for the same is as shown below:

CLOSE {cursor_variable_name | :host_cursor_variable_name);

In the illustration below, if the last row is processed, then you can close the cursor variable emp_cv:

LOOP

FETCH emp_cv INTO emp_rec;

EXIT WHEN emp_cv%NOTFOUND;

-- process data record

END LOOP;

/* Close cursor variable. */

CLOSE emp_cv;

Whenever declaring a cursor variable as the formal parameter of the subprogram which closes the cursor variable, you should specify the IN or IN OUT mode.

If you attempt to close an already-closed or never-opened cursor variable, the PL/SQL raises the predefined exception that is the INVALID_CURSOR.

Posted Date: 10/4/2012 4:05:15 AM | Location : United States







Related Discussions:- Closing a cursor variable, Assignment Help, Ask Question on Closing a cursor variable, Get Answer, Expert's Help, Closing a cursor variable Discussions

Write discussion on Closing a cursor variable
Your posts are moderated
Related Questions
Use the PLS_INTEGER Datatype When you require to declare an integer variable, use the datatype PLS_INTEGER that is the most efficient numeric type. That is as the PLS_INTEGER

Transaction context As the figure shows, the major transaction shares its context with the nested transactions, but not with the autonomous transactions. Similarly, If one aut

Write a stored procedure that accepts the post code in which the customer resides as the input parameter. The procedure should then use an explicit cursor to display comprehensive

SQL Is a Database Language: The commands given to a DBMS by an application are written in the database language of the DBMS. The term data sublanguage is sometimes used instea

Assignment Source Not a Literal - Variable Syntax: SET SN = SID (SUBSTRING (SN.C FROM 1 FOR 1)||'5');

Packages The package is a schema object which groups logically associated to the PL/SQL items, types, and subprograms. The Packages have 2 sections: the specification & the bod

Task 2 [12 marks] Write the package body for the following package specification (the detailed description of each function and procedure is provided in the appendix below). Place

Methods: In normal, a method is a subprogram declared in an object type specification using the keyword MEMBER or STATIC. The method cannot have similar name as the object typ

THEORY OF SPONTANEOUS GENERATION - ABIOGENESIS OR AUTOGENESIS - According to this theory, the existing living communities have originated from non-living organic matter with

Use Serially Reusable Packages To help you to manage the use of memory, the PL/SQL gives the pragma SERIALLY_ REUSABLE that mark some packages as serially reusable . So mark