background image
<< Correlating Queries with Output Placeholders | the next available number >>
<< Correlating Queries with Output Placeholders | the next available number >>

Correlating Queries for Tables with Constraints

Creating Vuser Scripts
Chapter 10, page 182
Database Vuser Scripts · Correlating Database Statements
In
Correlating Queries for Tables with Constraints
In instances where table columns have constraints such as Unique, correlating
your script's queries may be the only way to run the script. For example, if during
recording, you inserted a value into a table with a Unique key constraint, you will
be unable to insert the same value again. If you try to run the script as recorded,
you will get a database error.
The following example illustrates a query with a Unique constraint using
lrd_save_col and lrd_save_value described in the above section. A company's
personnel department wants to insert a new record into the employee database.
The new employee is assigned the next available ID number. In order to insert a
complete record for an employee, the operator must know the next available ID
number. Two employees cannot have the same ID number--ID numbers must be
unique. Therefore, the operator performs a query for the number of records in the
employees
table. Based on that result, the operator inserts a new employee with