3. Statements : OpenROAD SQL Statements : Copy Statement : With Clause for Copy
 
Share this page                  
With Clause for Copy
Valid with clause options for the copy statement are as follows:
On_error=TERMINATE|CONTINUE
on_error = TERMINATE | CONTINUE
Directs copy to continue after encountering conversion errors.
To direct copy to continue until a specified number of conversion errors have occurred, specify the error_count option instead.
By default, copy terminates when an error occurs while converting between table format and file format
When on_error is set to CONTINUE, copy displays a warning whenever a conversion error occurs, skips the row that caused the error, and continues processing the remaining rows. At the end of the processing, copy displays a message that indicates how many warnings were issued and how many rows were successfully copied.
Setting on_error to CONTINUE does not affect how copy responds to errors other than conversion errors. Any other error, such as an error writing the file, terminates the copy operation.
Error_count=n
error_count = n
Specifies how many errors can occur before processing terminates.
Default: 1.
If on_error is set to continue, setting error_count has no effect.
Log='filename'
log = 'filename'
Stores to a file any rows that copy cannot process. This option can be used only if on_error CONTINUE is specified. When specified with log, copy places any rows that it cannot process into the specified log file. For copy into, the logged rows are in database (binary) format; for copy from, the logged rows are in file format.
Logging works as follows:
Windows: Copy opens the log file prior to the start of data transfer. If it cannot open the log file, copy halts. If an error occurs when writing to the log file, copy issues a warning, but continues. If the specified log file already exists, it is overwritten with the new values (or truncated if the copy operation encounters no bad rows).
UNIX: Copy opens the log file prior to the start of data transfer. If it cannot open the log file, copy halts. If an error occurs when writing to the log file, copy issues a warning, but continues. If the specified log file already exists, it is overwritten with the new values (or truncated if the copy operation encounters no bad rows).
The log option is not available if the table contains any long columns, whether they are part of the copy list or not.
If copying from a data file that contains duplicate rows (or rows that duplicate rows already in the table) to a table that was created with noduplicates and has a HASH, ISAM or BTREE storage structure, copy displays a warning message and does not add the duplicate rows. If the with log option is specified, copy does not write the duplicate rows to the log file.
If copying from a data file that contains duplicate keys (or keys that duplicate keys already in the table) to a table that enforces the unique key, copy displays a warning message and does not add the rows containing the duplicate keys. This operation is sequential so that the first row is copied to the table and a second row with the same key fails.
Rollback=ENABLED|DISABLED
rollback = ENABLED | DISABLED
Enables or disables rollback, as follows:
ENABLED
Directs the DBMS Server to back out all rows appended by the copy if the copy is terminated due to an error.
DISABLED
Retains the appended rows.
The rollback=DISABLED option does not mean that the copy cannot be rolled back. Database server errors that indicate data corruption will always roll back the copy statement. In addition, the user may decide to rollback the entire transaction rather than committing it with a commit.
Default: ENABLED
When copying to a file, the with rollback clause has no effect.
Row_estimate
row_estimate
Specifies the estimated number of rows to be copied from a file to a table during a bulk copy operation. The DBMS Server uses the specified value to allocate memory for sorting rows before inserting them into the table. An accurate estimate can enhance the performance of the copy operation.
The estimated number of rows must be no less than 0 and no greater than 2,147,483,647. If this parameter is omitted, the default value is 0, in which case the DBMS Server makes its own estimates for disk and memory requirements.