6. QUEL and EQUEL Statements : Copy Statement--Copy Data : Column Formats for COPY : Counted Character Formats
 
Share this page                  
Counted Character Formats
The BYTE VARYING and VARCHAR formats are "counted" formats: each data file value is preceded by a character count. The character count defines the length of the data value; the actual field length as defined by a fixed-length specifier or a delimiter may be larger. On input (COPY FROM), extra field characters beyond those included by the embedded character count are ignored. On output (COPY INTO), any extra field length after the actual value is filled with padding, as defined by the specific format.
The fixed-length forms are BYTE VARYING(n) and VARCHAR(n). The variable-length forms are BYTE VARYING(0) and VARCHAR(0). An optional delim may follow to specify a delimiter.
For all fixed-length counted formats: the field length N does not include the preceding length specifier. For example, a VARCHAR(1) field takes 6 bytes. When reading data (COPY FROM), if the character count found in the data is larger than the defined length, a runtime conversion warning is issued and the row is not loaded.