Previous Topic

Next Topic

Close

Valid in: ESQL

The Close statement closes an open cursor. The cursor_name must have been previously defined in your source file by a declare cursor statement. Once closed, the cursor cannot be used for further processing unless reopened with a second open statement. A commit, rollback, or disconnect statement closes all open cursors.

Previous Topic

Next Topic

Syntax

The Close statement has the following format:

EXEC SQL CLOSE cursor_name

Previous Topic

Next Topic

Embedded Usage

In an embedded Close statement, a string constant or host language variable can be used to specify the cursor name.

Previous Topic

Next Topic

Permissions

All users are permitted to use this statement.

Previous Topic

Next Topic

Locking

In the Close statement, closing a cursor does not release the locks held by the cursor. (The locks are released when the transaction is completed.)

Previous Topic

Next Topic

Related Statements

Declare Cursor

Fetch

Open

Previous Topic

Next Topic

Example: Close

The following example illustrates cursor processing from cursor declaration to closing:

exec sql declare c1 cursor for
select ename, jobid
from employee
where jobid = 1000;
...
exec sql open c1;
loop until no more rows;
exec sql fetch c1
     into :name, :jobid;
print name, jobid;
end loop;

exec sql close c1;


© 2007 Ingres Corporation. All rights reserved.