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 | 



DEFAULT Function

Description

The DEFAULT function returns a default value defined for a column. If a default value has not been specified for the given column, NULL or an error is returned. If any of constraints is not defined or the UNIQUE constraint is defined for the column where a default value is not defined, NULL is returned. If NOT NULL or PRIMARY KEY constraint is defined, an error is returned.

Syntax

DEFAULT(column_name)

Example

CREATE TABLE info_tbl(id INT DEFAULT 0, name VARCHAR)

INSERT INTO info_tbl VALUES (1,'a'),(2,'b'),(NULL,'c');

 

3 rows affected.

 

SELECT id, DEFAULT(id) FROM info_tbl;

           id   default(id)  

=============================

            1             0

            2             0  

         NULL             0