Session Statement

A session statement is created using a SQL SELECT string and the table for the query is determined by parsing the SELECT string.

Procedure

  1. Formulate a SQL SELECT string for the query you want to use to retrieve rows from a table.
  2. Call the create statement method of the session object.
    Supply the SQL SELECT string as an argument.
  3. Call the statement methods to set the parameter values for the query.
  4. Run the query by calling the statement method to execute the query.
    A result set object is returned which contains the rows which satisfy the query.
  5. Read the rows of the query result by looping and calling the following methods until no more rows are available to read:
    1. Call the has next method of the result set to see if there is a row to read.
    2. Call the next method of the result set to read the next row.
  6. When all of the rows have been read, close the result set object.
  7. Optionally set different parameter values and re-execute the query by repeating Step 3 - Step 6.
  8. Close the statement object.
Related tasks