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 Actian X 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 Actian X to indicate success. If a handler returns a non-zero status, Actian X raises an error and aborts COPY.
The ON_ERROR = CONTINUE clause applies to row-to-tuple and tuple-to-row conversions in COPY; it does not apply to reading or writing to a file or user program.
• 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: 04/26/2024