SQLJ Iterator Declaration page
Use this page to specify information for the SQLJ iterator declaration clause that you are creating.
An iterator is used to retrieve values from the result table from a query. An iterator is an object of an iterator class. An SQLJ file generates an iterator class for each iterator declaration clause that you specify. An iterator declaration clause declares a positioned iterator class or a named iterator class in an SQLJ file.
- Name
- The valid Java identifier to use for the generated iterator class.
- Modifiers
- The access modifiers for the generated class. You can choose one of the following modifiers: public, protected, private, or default.
- static
- Declares the generated class static.
- Implements
- sqlj.runtime.ForUpdate
- Implements the sqlj.runtime.ForUpdate interface for using positioned UPDATE or DELETE operations. For positioned UPDATE and DELETE operations, the iterator must be declared in one source file and used in a different source file.
If this option is selected, the Update columns option is available.
- sqlj.runtime.Scrollable
- Implements the sqlj.runtime.Scrollable interface when you want to declare a scrollable iterator. A scrollable iterator is an iterator in which you can move forward, backward, or to a specific row in the query result table.
If this option is selected, the Sensitivity option is available.
- User interface
- A list of the additional interface classes to implement. Entries in the list are separated by commas.
- With
- Specifies the attributes of an SQLJ WITH clause.
- Holdability
- Specifies whether an iterator keeps its position in a table after a COMMIT command is issued. You can choose:
- true
- The iterator keeps its position.
- false
- The iterator does not keep its position.
- default
- The holdability attribute retains its default value, which is false.
- Sensitivity
- Specifies whether changes that are made to the underlying table of an iterator can be visible to the iterator after it is opened. You can choose:
This attribute of the SQLJ WITH clause is available only when the sqlj.runtime.Scrollable check box is selected.
- SENSITIVE
- Changes that are made to the underlying table are visible. When this option is selected, the Dynamic option is available.
- INSENSITIVE
- Changes that are made to the underlying table are not visible.
- default
- The sensitivity attribute retains its default value, which is INSENSITIVE.
- Dynamic
- For an iterator that is defined with the Sensitivity option set to SENSITIVE, specifies the state of the following cases:
- When the application runs positioned UPDATE and DELETE statements with the iterator, those changes are visible to the iterator.
- When the application runs INSERT, UPDATE, and DELETE statements within the application but outside the iterator, those changes are visible to the iterator.
You can choose:
If the Dynamic option is set to true, the data source must support dynamic scrollable cursors.
- true
- Both cases are true.
- false
- Both cases are false.
- default
- The dynamic attribute retains its default value, which is false.
The Dynamic option is available only when the sqlj.runtime.Scrollable check box is selected.
- Update columns
- The names of the columns that are to be modified when the iterator is used for a positioned UPDATE statement. Names in the list are separated by commas. If the Select Columns button is shown, you can select the columns rather than type them.
This attribute of the SQLJ WITH clause is available only when the sqlj.runtime.ForUpdate check box is selected.
- Column declarations
- Defines the column declarations for the columns in the result table of the SQLJ iterator declaration.
In the Insert SQLJ Iterator wizard, you can specify either of the following sets of information:
- The data types for the columns in the result table, which declares a positioned iterator. The data types in the list are separated by commas. The order of the data types in the positioned iterator declaration must be the same as the order of the columns in the result table.
- The data type-name pairs for the columns in the result table, which declares a named iterator. The data type-name pairs in the list are 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.
In the Insert SQL Clause wizard, you can choose either of the following options:
- Positioned
- The data types for the columns in the result table. Selecting this option creates a positioned iterator column declaration.
- Named
- The names and data types for the columns in the result table. Selecting this option creates a named iterator column declaration.
Parent topic: Adding an SQLJ iterator declaration clause to an SQLJ file
Parent topic: Adding an SQLJ assignment clause to an SQLJ file
Related tasks
Performing positioned UPDATE and DELETE operations in an SQLJ application
Using scrollable iterators in an SQLJ application
Using a named iterator in an SQLJ application
Related reference
SQLJ iterator-declaration-clause
Select existing SQL statement page
Variables page