AT
identifies the database on which the cursor is declared. The database can be identified by either:
db_name is a database identifier declared in a previous DECLARE DATABASE statement.
:host_variable is a host variable whose value is a previously declared db_name.
If you omit this clause, Oracle7 declares the cursor on your default database.
cursor
is the name of the cursor to be declared.
SELECT command
is a SELECT statement to be associated with the cursor. The following statement cannot contain an INTO clause.
statement_name block_name
identifies a SQL statement or PL/SQL block to be associated with the cursor. The statement_name or block_name must be previously declared in a DECLARE STATEMENT statement.
You can reference the cursor in the WHERE clause of an UPDATE or DELETE statement using the CURRENT OF syntax, provided that the cursor has been opened with an OPEN statement and positioned on a row with a FETCH statement. For more information on this command, see Programmer's Guide to the Oracle Precompilers.
Example
This example illustrates the use of a DECLARE CURSOR:
EXEC SQL DECLARE emp_cursor CURSOR
FOR SELECT ename, empno, job, sal
FROM emp
WHERE deptno = :deptno
FOR UPDATE OF sal