EasyManua.ls Logo

HP NonStop SQL/MP

HP NonStop SQL/MP
331 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Explicit Program Compilation
HP NonStop SQL/MP Programming Manual for C429847-008
6-37
Dynamic SQL Statements
In this example, the CONTROL EXECUTOR directive specifies parallel evaluation
when the program runs the first FETCH statement for the cursor.
EXEC SQL CONTROL EXECUTOR PARALLEL EXECUTION ON;
EXEC SQL DECLARE list_customers_with_orders CURSOR FOR
SELECT CUSTOMER.CUSTNUM, CUSTOMER.CUSTNAME
FROM =CUSTOMER, =ORDERS
WHERE CUSTOMER.CUSTNUM = ORDERS.CUSTNUM
STABLE ACCESS;
This example varies the wait time for cursors that access the PARTS table. The default
wait time (60 seconds) applies only to the first cursor (cursor1).
...
/* Default wait... */
EXEC SQL
DECLARE CURSOR cursor1
FOR SELECT partnum,partdesc,price
FROM sales.parts
WHERE (partnum > :min_partnum AND partnum < :max_partnum)
ORDER BY partnum;
/* Short wait... .*/
EXEC SQL CONTROL TABLE sales.parts TIMEOUT .1 SECOND;
EXEC SQL
DECLARE CURSOR cursor2
FOR SELECT partnum,partdesc,price
FROM sales.parts
WHERE (partnum > :min_partnum AND partnum < :max_partnum)
ORDER BY partnum;
/* Infinite wait....*/
EXEC SQL CONTROL TABLE sales.parts TIMEOUT -1 SECOND;
EXEC SQL
DECLARE CURSOR cursor3
FOR SELECT partnum,partdesc,price
FROM sales.parts
WHERE (partnum > :min_partnum AND partnum < :max_partnum)
ORDER BY partnum;
...
Dynamic SQL Statements
A static CONTROL TABLE directive does not affect dynamic SQL statements. To use a
CONTROL TABLE directive with dynamic SQL statements, specify a dynamic
CONTROL TABLE directive by using the PREPARE and EXECUTE (or EXECUTE
IMMEDIATE) statements.

Table of Contents

Related product manuals