Implementing Query-by-Example
This program implements query-by-example, using the CONSTRUCT
statement to allow the user to enter search criteria in a form. The criteria is used to
build an SQL SELECT
statement which will retrieve rows from the
customer
database table.
A SCROLL CURSOR
is defined in the program, to allow the user to scroll
back and forth between the rows of the result set. The SQLCA.SQLCODE
is
used to test the success of the SQL statements. Handling errors, and allowing the user
to cancel the query, is illustrated.