SQL/MX 2.x Reference Manual (H06.04+)

SQL/MX Statements
HP NonStop SQL/MX Reference Manual540440-003
2-217
C Examples of SET TABLE TIMEOUT
Reset all the lock timeout settings. All tables will use the static lock timeout value
specified by the system or by the CONTROL statement:
SET TABLE * TIMEOUT RESET;
C Examples of SET TABLE TIMEOUT
Set the lock timeout value for all the tables to 30 seconds:
EXEC SQL SET TABLE * TIMEOUT 3000;
Set the lock timeout value for the CUSTOMER table to 1 minute:
EXEC SQL SET TABLE CUSTOMER TIMEOUT '6000';
SELECT CUSTNUM, CUSTNAME, STREET, CITY, STATE, POSTCODE
INTO :hv_custnum, :hv_custname,
:hv_street, :hv_city, :hv_state, :hv_postcode
FROM CUSTOMER
WHERE CUSTNUM = :hv_custnum;
This SET TABLE TIMEOUT statement has no effect because the cursor is already
open:
EXEC SQL DECLARE mycursor CURSOR
FOR SELECT custname FROM customer;
EXEC SQL OPEN mycursor;
EXEC SQL SET TABLE customer TIMEOUT '-1';
EXEC SQL FETCH mycursor INTO :customer_name;
Reset the timeout value for the CUSTOMER table to 30 seconds (set earlier for all
tables):
EXEC SQL SET TABLE CUSTOMER TIMEOUT RESET;
This SET TABLE statement has no effect; the PARTS table still uses the lock
timeout value of 30 seconds (set earlier for all tables):
EXEC SQL SET TABLE PARTS TIMEOUT RESET;
Reset all the lock timeout settings. All tables will use the static lock timeout values
set during explicit SQL/MX compilation:
EXEC SQL SET TABLE * TIMEOUT RESET;
Set all streams to use a timeout of two minutes, and then reset the stream timeout
to its original compile-time value:
EXEC SQL SET TABLE * STREAM TIMEOUT 12000;
EXEC SQL SELECT col1, col2 FROM STREAM(myqueue);
...
EXEC SQL SET TABLE * STREAM TIMEOUT RESET;
Use a host variable to set a timeout value entered by a user:
/* Input timeout value into a host variable */
scanf("%ld",&hv_timeout);