SQLJ iterator-declaration-clause
An iterator declaration clause declares a positioned iterator class or a named iterator class in an SQLJ application program.
An iterator contains the result table from a query. SQLJ generates an iterator class for each iterator declaration clause you specify. An iterator is an object of an iterator class.
An iterator declaration clause has a form for a positioned iterator and a form for a named iterator. The two kinds of iterators are distinct and incompatible Java™ types that are implemented with different interfaces.
Syntax
positioned-iterator-column declarations:
named-iterator-column-declarations:
Description
- Java-modifiers
- Any modifiers that are valid for Java class declarations, such as static, public, private, or protected.
- Java-class-name
- Any valid Java identifier. During the program preparation process, SQLJ generates an iterator class whose name is this identifier.
- implements-clause
- See "SQLJ implements-clause" for a description of this clause. For an iterator declaration clause that declares an iterator for a positioned UPDATE or positioned DELETE operation, the implements clause must specify interface sqlj.runtime.ForUpdate. For an iterator declaration clause that declares a scrollable iterator, the implements clause must specify interface sqlj.runtime.Scrollable.
- with-clause
- See "SQLJ with-clause" for a description of this clause.
- positioned-iterator-column-declarations
- Specifies a list of Java data types, which are the data types of the columns in the positioned iterator. The data types in the list must be separated by commas. The order of the data types in the positioned iterator declaration is the same as the order of the columns in the result table. For online checking during serialized profile customization to succeed, the data types of the columns in the iterator must be compatible with the data types of the columns in the result table. See "Java, JDBC, and SQL data types" for a list of compatible data types.
- named-iterator-column-declarations
- Specifies a list of Java data types and Java identifiers, which are the data types and names of the columns in the named iterator. Pairs of data types and names must be separated by commas. The name of a column in the iterator must match, except for case, the name of a column in the result table. For online checking during serialized profile customization to succeed, the data types of the columns in the iterator must be compatible with the data types of the columns in the result table. See "Java, JDBC, and SQL data types" for a list of compatible data types.
Usage notes
- An iterator declaration clause can appear anywhere in a Java program that a Java class declaration can appear.
- When a named iterator declaration contains more than one pair of Java data types and Java IDs, all Java IDs within the list must be unique. Two Java IDs are not unique if they differ only in case.