SQLJ assignment-clause

The assignment clause assigns the result of an SQL operation to a Java™ variable.

Syntax

Read syntax diagramSkip visual syntax diagramJava-ID={ fullselectorder-by-clauseoptimize-for-clauseisolation-clausequeryno-clausefetch-first-clauseiterator-conversion-clause }

Description

Java-ID
Identifies an iterator that was declared previously as an instance of an iterator class.
fullselect
Generates a result table.
iterator-conversion-clause
See "SQLJ iterator-conversion-clause" for a description of this clause.

Usage notes

  • If the object that is identified by Java-ID is a positioned iterator, the number of columns in the result set must match the number of columns in the iterator. In addition, the data type of each column in the result set must be compatible with the data type of the corresponding column in the iterator. See "Java, JDBC, and SQL data types" for a list of compatible Java and SQL data types.
  • If the object that is identified by Java-ID is a named iterator, the name of each accessor method must match, except for case, the name of a column in the result set. In addition, the data type of the object that an accessor method returns must be compatible with the data type of the corresponding column in the result set.
  • You can put an assignment clause anywhere in a Java program that a Java assignment statement can appear. However, you cannot put an assignment clause where a Java assignment expression can appear. For example, you cannot specify an assignment clause in the control list of a for statement.