(Contents)(Previous)(Next)

DATAEXTRACT FOR DATAUPDATE

This statement generates a command file which contains a DATAUPDATE statement and the extracted data. This command file can be used for restoring defined contents after modifying the table.

Syntax:

Example:

DATAEXTRACT WITH LOCK

FOR DATAUPDATE TABLE customer ;

OUTFILE customer.upd

The table <table name> must have at least one key column. Otherwise, it would be impossible to unambiguously restore the backed up state.

An SQL SELECT statement is executed. It selects all the columns and all the rows of the table. When the option WITH LOCK is specified, the table is read locked during execution so that no simultaneous modifications can be made to it. When an ORDER BY clause is specified, it is added to the SELECT statement.

A DATAUPDATE statement is generated for the table and written into the specified file. With this statement, modifications made to the table can be rolled back to the state represented by the selected data.

As a precaution, the table and column names are treated as <special identifier>s and are enclosed in double quotation marks. This notation is mandatory if a name contains special characters or is identical with an SQL keyword or if upper- and lowercase characters are to be distinguished.

If two OUTFILE specifications are made, the first file contains the statements, the second one the data.

The DATAUPDATE statement contains DEFAULT NULL conditions for the optional columns of the table. The NULL representation used is recorded as file option NULL '<string>'.

The DATAUPDATE statement contains complete specifications of all input formats and can therefore be executed independently of the current SET specification (see DATAEXTRACT FOR DATALOAD ).

The selected data is written into the file in accordance with the default conventions. An explicit description of the output format (e.g., DECIMAL, IF-NULL-SET-POS) is not possible.

Empty tables are handled in the same way as in case of DATAEXTRACT FOR DATALOAD (see chapter DATAEXTRACT FOR DATALOAD).


(Contents)(Previous)(Next)