NonStop SQL/MP Reference Manual

Table Of Contents
NonStop SQL/MP Reference Manual142115
F-32
Examples—FREE RESOURCES
to an audited table only if the FREE RESOURCES statement executes in the same
transaction as the most recent OPEN of the cursor.
Examples—FREE RESOURCES
The following example shows FREE RESOURCES used to release locks acquired
by SQLCI on a nonaudited file.
Suppose JOB is a nonaudited table and AUTOWORK AUDITONLY is ON.
Because the INSERT uses REPEATABLE access, locks are not released when the
SQLCI-defined transaction ends. The FREE RESOURCES statement (without
AUDITONLY) releases the locks.
>> VOLUME $VOL1.PERSNL;
>> INSERT INTO JOB VALUES (650, "ADMIN ASSISTANT")
+> REPEATABLE ACCESS;
-- 1 row(s) inserted.
...
>> FREE RESOURCES;
-- SQL operation complete.
The following example shows FREE RESOURCES in a host program where it also
deallocates buffer space used for cursors:
EXEC SQL OPEN CURSOR1;
...
EXEC SQL FETCH CURSOR1;
...
EXEC SQL DELETE FROM...
WHERE CURRENT OF CURSOR1;
...
EXEC SQL FREE RESOURCES;
Functions
The following table summarizes the functions in NonStop SQL/MP.
AVG Function Returns the average of a set of numbers
CAST Function Associates a data type with a parameter
COMPUTE_TIMESTAMP
Function
Returns a Julian timestamp for a specified date and time
CONVERTTIMESTAMP
Function
Converts a Julian timestamp to a DATETIME value