Syntax
The COPY FROM | INTO PROGRAM statement has the following format:
[EXEC SQL] COPY [TABLE] [schema.]table_name
([column_name = format [WITH NULL [(value)]]
{, column_name = format [WITH NULL [(value)]]}])
INTO | FROM PROGRAM
WITH COPYHANDLER = func_name
[,with_clause];
table_name
Specifies an existing table from which data is read or to which data is written.
column_name
Specifies the column from which data is read or to which data is written.
format
Specifies the format in which a value is stored in the file.
func_name
The COPYHANDLER option tells Ingres the name of the user-defined function func_name to call to get or store a row of data.
Note: The func_name option should not be declared in an ESQL declare section. However, it must be declared in a way that complies with the C compiler.
with_clause
Consists of a comma, followed by a comma-separated list of one or more of the following items:
• ON_ERROR = TERMINATE | CONTINUE
Note: The user-defined handlers for COPY FROM | INTO PROGRAM must return an integer status of 0 to Ingres to indicate success. If a handler returns a non-zero status, Ingres raises an error and aborts COPY.
The ON_ERROR = CONTINUE clause does not apply to reading or writing to a file or user program; it applies to row-to-tuple and tuple-to-row conversions in COPY.
• ERROR_COUNT = n
• ROLLBACK = ENABLED | DISABLED
• LOG = 'filename'
The following options are valid for bulk copy operations only. For details about these settings, see
Modify (see
MODIFY). The value specified for any of these options becomes the new setting for the table and overrides any previously made settings (either using the MODIFY statement or during a previous copy operation).
• ALLOCATION = n
• EXTEND = n
• FILLFACTOR=n (ISAM, Hash, and Btree only)
• MINPAGES=n (Hash only)
• MAXPAGES=n (Hash only)
• LEAFFILL=n (Btree only)
• NONLEAFFILL=n (Btree only)
• ROW_ESTIMATE = n