Was this helpful?
COPY FROM | INTO PROGRAM
Valid in: ESQL
The COPY FROM | INTO PROGRAM statement copies data from or to memory, providing the quickest way to bulk-load data. This statement differs from the COPY statement in that the COPY FROM | INTO PROGRAM statement declares a user-coded handler in the COPY statement WITH clause.
In a COPY INTO PROGRAM statement, COPY calls the user handler passing each row it receives from the DBMS.
In a COPY FROM PROGRAM statement, COPY calls the user handler for the next row of data until the handler indicates that there are no more rows.
The COPY FROM | INTO PROGRAM statement has the following format:
[EXEC SQL] COPY [TABLE] [schema.]tablename
([column_name = format [WITH NULL [(value)]]
{, column_name = format [WITH NULL [(value)]]}])
INTO | FROM PROGRAM
WITH COPYHANDLER = func_name
[,with_clause];
tablename
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. 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
Last modified date: 01/30/2023