Was this helpful?
PUT DATA
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]);
col 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.
length_value
(Optional) Signed 4-byte integer specifying the length of the data segment being written.
dataend_value
(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. When sending empty LOB data, for example, a zero-length BLOB (LONG BYTE), the PUT DATA call must be made with the SEGMENT parameter so that the client informs the DBMS of the correct data type. If the SEGMENT parameter is omitted, the client will default to sending CLOB (LONG VARCHAR).
Permissions
This statement is available to all users.
Related Statements
GET DATA
Last modified date: 08/29/2024