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.

Before you begin

The SQLJ file must be open in the SQLJ editor.

About this task

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

Procedure

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 SQL 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. If you want to select an existing statement, the statement must be stored in a data development project in your workspace.
    • 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 a new iterator declaration.
  4. On the Review SQLJ Clause page, click Finish.

Results

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


Feedback