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 a new iterator declaration.
  4. On the Review SQLJ Clause page, click Finish.

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

Related tasks
Adding an SQLJ connection declaration clause to an SQLJ file
Adding an SQLJ iterator declaration clause to an SQLJ file
Editing SQLJ files
Related reference
SQLJ wizards - Select an Existing SQL Statement Saved in Your Workspace page
SQLJ wizards - Specify SQL Statement Information page
SQLJ wizards - Select Connection page
Página Construir una sentencia SQL
Página Cambiar la sentencia SQL
Insert SQL Clause wizard - Variables page
SQLJ wizards - SQLJ Iterator Declaration page
SQLJ assignment-clause

Comentarios