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
PPD , CPA, Filesharing Site Project Description: This is very easy I need a PPD , CPA, Filesharing Site. [PPD] stands for (pay per download) example hotsharecash [Files

Using COUNT The COUNT returns the number of elements that a collection presently contains. For instance, when a varray projects contains 15 elements, then the following IF con

Explicit Cursor Attributes The cursor variable or each cursor has four attributes: %FOUND, %ISOPEN, %ROWCOUNT, and %NOTFOUND. When appended to the cursor or cursor variable, th

The SQL ‘CREATE TABLE' scripts for all the tables you have implemented. Note that your tables must correspond exactly to the ERD you have provided in 1. above, or you will lose ma

Use Native Dynamic SQL A few programs (a normal-purpose report writer for illustration) should build and process a variety of SQL statements at run time. Therefore, their full

Cursor Variables Similar to a cursor, cursor variable points to the current row in the result set of a multi-row query. But, dissimilar a cursor, a cursor variable can be opene

Fetching from a Cursor Variable The FETCH statement retrieve rows one at a time from the product set of a multi-row query. The syntax for the same is as shown: FETCH {curso

Change Sql file into CSV for product registration on Magento Project Description: I have a set of files that are in Sql format and could like for a developer to help me with

Advantages of Wrapping   The PL/SQL Wrapper convert the PL/SQL source code into a transitional form of the object code. By hiding the application internals, the Wrapper secure

Literature review