6. QUEL and EQUEL Statements : Copy Statement—Copy Data : Copy Statement Parameters : Formatted Copying
Formatted Copying
Formatted copying allows the type, number, and order of columns in the data file to differ from the table. By specifying a list of columns and their types in the COPY statement, you instruct Ingres to perform a formatted copy. The COPY statement list specifies the order and type of columns in the data file. Ingres uses the column names in the list to match up file data with the corresponding columns in the table.
For human readable text data files, the COPY list formats will almost always be a character type: char, c, text, or less commonly varchar or byte. The COPY statement converts (character) file data into table data types for COPY FROM, or the reverse for COPY INTO. The COPY list may contain other types as well, such as integer or decimal, but these are binary types for special programming situations; they are not human readable types. COPY also supports a "dummy" type, used to skip input data (FROM) or insert fixed output text (INTO).
If some table columns are not listed in the COPY list for a COPY FROM, those columns are defaulted. (If they are defined in the table as NOT DEFAULT, an error occurs.) If some table columns are not listed for a COPY INTO, those table columns simply do not appear in the output data file.
The order of columns in the table need not match the order in the data file. Remember that the order of columns in the COPY list reflects the order in the data file, not the order in the table. Additionally, a table column may be named more than once. (For COPY FROM, if a column is named multiple times, the last occurrence in the COPY list is the one that is stored into the table. Earlier occurrences undergo format conversion, but the result is discarded.)
Special restriction: If the table includes one or more LONG columns (such as long varchar or long byte), columns cannot be reordered across any LONG column. For example, if the table contains (int a, int b, long varchar c), a COPY statement could use the order (b,a,c); but a COPY statement asking for (a,c,b) would be illegal (you cannot move column b to occur after the LONG column c).
The values in the data file can be fixed-length, or variable-length. Values can optionally be ended with a delimiter; the delimiter is specified in the COPY list. COPY can also process a special case of delimited values, the comma separated values (CSV) delimiting form.
Note:  If II_DECIMAL is set to comma, be sure that when SQL syntax requires a comma (such as a fixed-length COPY type), that the comma is followed by a space. For example:
COPY TABLE t (col1=c20, col2=c30, d0=nl) INTO ‘t.out’: