Valid in: ESQL
The PUT DATA statement writes a segment of a long varchar, long nvarchar, or long byte column from an embedded program to a table. The PUT DATA statement is valid only in data handler routines. For details about data handler routines, see the chapter "Working with Embedded SQL" and the Embedded SQL Companion Guide.
The PUT DATA statement has the following format:
EXEC SQL PUT DATA(SEGMENT = col_value
[, SEGMENTLENGTH = length_value]
[, DATAEND = dataend_value]);
Specifies the value to be assigned to the column. The maximum length of a long varchar, long nvarchar, or long byte column is 2 GB.
(Optional) Signed 4-byte integer specifying the length of the data segment being written.
(Optional) Signed 4-byte integer specifying whether the segment is the last segment to be written. To indicate end-of-data, specify 1. To indicate that the segment is not the last, specify 0.
The host language variables for col_value, length_value, and dataend_value must be declared in a BEGIN DECLARE SECTION/END DECLARE SECTION block to the ESQL preprocessor.
The data handler must issue a PUT DATA statement with DATAEND set to 1 before exiting; otherwise, the DBMS Server issues a runtime error.
All users are permitted to use this statement.