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
-
Formulate a SQL SELECT string for the query you want to use to retrieve rows from a table.
-
Call the create statement method of the session object.
Supply the SQL SELECT string as an argument.
-
Call the statement methods to set the parameter values for the query.
-
Run the query by calling the statement method.
A result set object is returned which contains the rows which satisfy the query.
-
Read the rows of the query result by looping and calling the following methods until no more rows are available to read:
-
Call the
has next
method of the result set to see if there is a row to read.
-
Call the
next method of the result set to read the next row.
-
When all of the rows have been read, close the result set object.
-
Optionally set different parameter values and rerun the query by repeating
Step 3 -
Step 6.
-
Close the statement object.
Copyright © Cloud Software Group, Inc. All rights reserved.