Hitachi

Hitachi Advanced Database Setup and Operation Guide


15.8.2 When a column cannot be added to a base table

This subsection explains the steps to take when a column cannot be added to a base table by using the ALTER TABLE definition SQL statement.

In the following situations, you cannot add a column to a base table:

If a base table is non-updatable, release it from non-updatable status based on the explanation in 15.8.1 Steps to take when a base table becomes non-updatable. Then, re-execute the ALTER TABLE statement.

In other cases, add a column by performing the steps described in the following procedure.

■ Steps to take when a column cannot be added to a base table
  1. Output data in the base table to a file.

    Use the adbexport command to output all data from the base table to a file. An output data file is created. The output data file created here becomes the input data file used in steps 4 and 5.

  2. Delete all row data from the base table.

    Execute the TRUNCATE TABLE statement to delete all row data from the base table.

  3. Add a column to the base table.

    Add a column to the base table by re-executing the ALTER TABLE statement.

  4. Edit the input data file.

    Add the data to be stored in the column added in step 3 to the input data file created in step 1.

  5. Store data in the base table.

    Execute the adbimport command to store in the base table the data in the input data file that was edited in step 4.

Note

For details about the status in which segments for storing rows are assigned, see 5.3.1 Notes on defining B-tree indexes (unfinished status of B-tree indexes).