EasyManua.ls Logo

Sybase Adaptive Server Anywhere - FETCH Statement [ESQL] [SP]

Sybase Adaptive Server Anywhere
1182 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Chapter 9 SQL Statements
523
FETCH statement [ESQL] [SP]
Use this statement to reposition a cursor and then get data from it.
FETCH
cursor-position
cursor-name
… [ INTO {
host-variable-lis
t |
variable-list
}
| USING DESCRIPTOR
sqlda-name
]
… [ PURGE ]
… [ BLOCK
n
]
… [ FOR UPDATE ]
… [ ARRAY
fetch-count
]
INTO
variable-list
[ FOR UPDATE ]
cursor-position:
NEXT | PRIOR | FIRST | LAST | { ABSOLUTE | RELATIVE }
row-count
row-count
:
number
or
host
variable
cursor-name
:
identifier
or
host-variable
host-variable-list
: may contain indicator variables
variable-list
: Stored procedure variables
sqlda-name
:
identifier
fetch-count
:
integer
or
host
variable
The cursor must be opened, and the user must have SELECT permission on
the tables referenced in the declaration of the cursor.
None.
"DECLARE CURSOR statement" on page 488
"PREPARE statement" on page 578
"OPEN statement" on page 570
"Cursors in Embedded SQL" on page 33 of the book ASA Programming
Interfaces Guide
"Using cursors in procedures and triggers" on page 471 of the book ASA
User’s Guide
FETCH in PowerScript Reference
The FETCH statement retrieves one row from the named cursor. The cursor
must have been previously opened.
Embedded SQL use A DECLARE CURSOR statement must appear
before the FETCH statement in the C source code, and the OPEN statement
must be executed before the FETCH statement. If a host variable is being
used for the cursor name, the DECLARE statement actually generates code
and thus must be executed before the FETCH statement.
Function
Syntax
Permissions
Side effects
See also
Description

Table of Contents

Related product manuals