Starting from Altibase HDB version 5.3.3 or later, the column type and length of a table can be modified by using the ALTER TALBE ~ MODIFY COLUMN ~ statements.
ALTER TABLE table_name MODIFY COLUMN ( column_name column_type(length) )
If the table data is not NULL, data loss may occur depending on the conversion type. In order to change the data type at the expense of this data loss, TOLERATE DATA LOSS option can be used.
When the DATE type is changed, the column data is converted according to the DEFAULT_DATE_FORMATE property.
If used incorrectly, the column modify command may cause a load on the DB depending on data loss and the amount of data in the target table, so it should be used with precaution.
When modifying columns, if the table to be changed is a memory table and the current ALTIBASE version is 5.3.3, it is created in the memory table as a copy table for restoration.
In order words, there must be room for memory tablespaces. (For reference, in version 6.1.1, the copy table is saved as a disk tablespace, so if there are only a tablespace and a disk space, it is operatable.)
As recommended by ALTIBASE, if the target table is a memory table, backup is performed with an iloader operation, then a new target table is created and data is imported.
<Query> Change the isbn column of the table book to CHAR(20) type and the edition column to BIGINT type.
iSQL> ALTER TABLE book MODIFY COLUMN (isbn CHAR(20), edition BIGINT);
<Example> Below is an example of executing the above query.
iSQL> create table t1(c1 integer);
For more detailed information on how to use it, refer to how to use modify columns in the SQL Reference Manual.