Difference between revisions of "DECLARE CURSOR"
Yvonnemilne (Talk | contribs) |
Yvonnemilne (Talk | contribs) |
||
(3 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
==Purpose== | ==Purpose== | ||
Declares a pointer to a logical table | Declares a pointer to a logical table | ||
Line 16: | Line 9: | ||
==See Also== | ==See Also== | ||
− | [[SQL CLOSE|CLOSE]], [[DROP CURSOR]], [[FETCH]], [[OPEN]], [[SQL SELECT|SELECT]] | + | [[SQL CLOSE|CLOSE]], [[DROP CURSOR]], [[FETCH]], [[SQL INSERT|INSERT]], [[OPEN]], [[SQL SELECT|SELECT]] |
Line 44: | Line 37: | ||
<code lang="recital"> | <code lang="recital"> | ||
// Declare the cursor to select records from the accounts table | // Declare the cursor to select records from the accounts table | ||
− | + | DECLARE accounts; | |
− | DECLARE accounts CURSOR FOR | + | CURSOR FOR; |
− | SELECT name,address,ord_value,balance | + | SELECT name, address, ord_value, balance; |
− | FROM accounts | + | FROM accounts; |
− | ORDER BY name | + | ORDER BY name |
</code> | </code> | ||
==Products== | ==Products== | ||
− | Recital | + | Recital Server, Recital |
[[Category:Documentation]] | [[Category:Documentation]] | ||
[[Category:SQL]] | [[Category:SQL]] | ||
[[Category:Commands]] | [[Category:Commands]] |
Latest revision as of 14:35, 22 December 2009
Purpose
Declares a pointer to a logical table
Syntax
DECLARE <cursor> [READ ONLY | INSERT ONLY] [TABLE] CURSOR FOR SELECT <statement>
See Also
CLOSE, DROP CURSOR, FETCH, INSERT, OPEN, SELECT
Description
The DECLARE CURSOR command declares a cursor to represent the active set of rows specified by a SELECT or INSERT statement. It declares a cursor (a pointer to a logical table) to be processed in an application program. A logical table is a temporary collection of data that satisfy conditions specified in a SELECT statement. Declared cursors are opened with the OPEN statement and closed with the CLOSE statement. After a cursor has been CLOSED, it may be accessed again by issuing another OPEN statement. A cursor is not released until a DROP CURSOR statement is issued.
This command can only be used in Embedded SQL. The cursor cannot already be open.
Keywords | Description |
---|---|
cursor | The name of the cursor to be opened. |
READ ONLY | The cursor is opened read only. |
INSERT ONLY | The cursor is opened for inserts only. |
TABLE | This is for compatibility only. |
SELECT statement | This is a SELECT statement to be associated with the cursor. The select statement cannot contain an INTO clause. |
Example
// Declare the cursor to select records from the accounts table DECLARE accounts; CURSOR FOR; SELECT name, address, ord_value, balance; FROM accounts; ORDER BY name
Products
Recital Server, Recital