Adding an SQLJ assignment clause to an SQLJ file

You can use a wizard to add an SQLJ assignment clause to an SQLJ file. An SQLJ assignment clause assigns the result of an SQL operation to a Java variable.

Prerequisite: The SQLJ file must be open in the SQLJ editor.

You can insert an SQLJ assignment clause anywhere in an SQLJ file that a Java assignment statement can appear in a Java program.

To add an SQLJ assignment clause:

  1. In the open SQLJ file, place the cursor at the location in the code where you want to add the SQLJ assignment clause.

  2. Right-click at the insertion point, and then click SQLJ Assist > Insert SQLJ Clause on the pop-up menu.

  3. Use the wizard to do the following steps:

    • Either select an existing SQL SELECT statement or create a new one.

    • Specify other variables for the SQLJ clause, including the name of the variable to which to assign the SQL SELECT operation.

    • (Optional) Specify the information for generated new class iterator class declaration.

  4. On the Review SQLJ Clause page, click Finish.

The SQLJ assignment clause is added to the code at the insertion point.

 

Parent topic

Developing SQLJ applications

 

Related tasks

Adding an SQLJ connection declaration clause to an SQLJ file
Adding an SQLJ iterator declaration clause to an SQLJ file

Related reference
SQLJ assignment-clause
Select existing SQL statement page
Variables page
SQLJ Iterator Declaration page