| GNADE User's Guide: GNADE, The GNat Ada Database Environment; Version 1.5.0; Document Revision $Revision: 1.42 $ | ||
|---|---|---|
| Prev | Chapter 10. Embedded SQL Syntax Specification | Next |
A query may be issued by either defining a cursor or a direct query where only one row is expected. The syntax for the later case is shown below.
<query> ::=
'SELECT' <column list>
'INTO' <host variable list>
'WHERE'...... rest of query ......
;
<host variable list> ::=
<variable> [ ['INDICATOR'] <variable>
| <host variable list>
| <empty>
;
<variable> :: = ':' <identifier> ;
The esql handles this statement as a normal SQL statement but removing the 'INTO' clause from the SQL string which is sent to the dbcs. The host variables listed in the <host variable list> are used to store the columns of the query result.
<fetch clause;> ::=
'FETCH' <source;> 'INTO' <host variable list> ;
<source;> := {
<empty>
| 'FROM' <cursor>
| 'USING' [ 'STATEMENT' ] <statementname>
}
Either a cursor name or a statement name (see dynamic sql) may be given as a source for the fetch command. If the source if left empty, a unnamed cusrsor will be assumed.
ATTENTION: The unnamed cursor has a global nature, which means there is only one unnamed cursor which is reallocated for each query. Any subsequent query with an unnamed cursor will destroy the previously allocated result sets.