Open Source RDBMS - Seamless, Scalable, Stable and Free

한국어 | Login |Register

Versions available for this page: CUBRID 8.3.0 |  CUBRID 8.3.1 |  CUBRID 8.4.0 |  CUBRID 8.4.1 |  CUBRID 8.4.3 |  CUBRID 9.0.0 | 

ALTER COLUMN ... SET DEFAULT Clause

Description

You can specify a new default value for a column that has no default value or modify the existing default value by using the ALTER COLUMNSET DEFAULT. You can use the CHANGE clause to change the default value of multiple columns with a single statement. For details, see the CHANGE Clause.

Syntax

ALTER [ TABLE | CLASS ] table_name ALTER [COLUMN] column_name SET DEFAULT value

  • table_name: Specifies the name of a table that has a column whose default value is to be modified.
  • column_name: Specifies the name of a column whose default value is to be modified.
  • value: Specifies a new default value.
Example

;schema a_tbl

 

=== <Help: Schema of a Class> ===

 

 

 <Class Name>

 

     a_tbl

 

 <Attributes>

 

     name                 CHARACTER VARYING(1073741823)

     phone                CHARACTER VARYING(13) DEFAULT '000-0000-0000'

     age                  INTEGER

     id                   INTEGER AUTO_INCREMENT  NOT NULL

 

 <Constraints>

 

     UNIQUE u_a_tbl_id ON a_tbl (id)

 

 

Current transaction has been committed.

 

 

ALTER TABLE a_tbl ALTER COLUMN name SET DEFAULT '';

ALTER TABLE a_tbl ALTER COLUMN phone SET DEFAULT '111-1111';

 

;schema a_tbl

 

=== <Help: Schema of a Class> ===

 

 

 <Class Name>

 

     a_tbl

 

 <Attributes>

 

     name                 CHARACTER VARYING(1073741823) DEFAULT ''

     phone                CHARACTER VARYING(13) DEFAULT '111-1111'

     age                  INTEGER

     id                   INTEGER AUTO_INCREMENT  NOT NULL

 

 <Constraints>

 

     UNIQUE u_a_tbl_id ON a_tbl (id)