Manage memory for rows
- The ALLOCATE ROW statement allocates memory for the specified row variable.
This row variable can be a typed or untyped row. The ALLOCATE ROW statement sets SQLCODE (sqlca.sqlcode) to zero if the memory allocation was successful and a negative error code if the allocation failed.
- The DEALLOCATE ROW statement deallocates or frees memory for a
specified row variable.
After you free the row variable with the DEALLOCATE ROW statement, you can reuse the row variable but you must allocate memory for it again. You might, for example, use an untyped row variable to store different row types in succession.
EXEC SQL BEGIN DECLARE SECTION;
row (
fname char(15),
mi char(2)
lname char(15)
) a_name;
EXEC SQL END DECLARE SECTION;
;
EXEC SQL allocate row :a_name;
;
EXEC SQL deallocate row :a_name;
For syntax information for the ALLOCATE ROW and DEALLOCATE ROW statements, see their descriptions in the HCL OneDB™ Guide to SQL: Syntax.