background image
<< Correlating Queries with Binding— | Correlating Queries with Output Placeholders >>
<< Correlating Queries with Binding— | Correlating Queries with Output Placeholders >>

new variable

Creating Vuser Scripts
Chapter 10, page 180
Database Vuser Scripts · Correlating Database Statements
In
To correlate the queries, you save the result of the first query to a new variable,
emp_id
using lrd_save_col. You replace the constant 777 with the new variable
name. The saved value is assigned to the placeholder by lrd_assign_bind.
lrd_stmt(Csr1, "select id from employees where name='John'", ...);
lrd_bind_col(Csr1,...);
lrd_exec(Csr1, ...);
lrd_save_col(Csr1, 1, 1, 0, "emp_id");
lrd_fetch(Csr1, 1, ...);
lrd_stmt(Csr1, "select salary from payment where year='1996' and
id=:id",...);
lrd_assign_bind(Csr1, "id", "<emp_id>", &id_D4...);
lrd_exec(Csr1, ...);