SQL> create table test1(id number, col varchar2(16) default 'DEF' NOT NULL);

Table created.

SQL> insert into test1(id, col) values(1, NULL);
insert into test1(id, col) values(1, NULL)
                                     *
ERROR at line 1:
ORA-01400: cannot insert NULL into ("SYS"."TEST1"."COL")


SQL> desc test1
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 ID                                                 NUMBER
 COL                                       NOT NULL VARCHAR2(16)

在这里插入图片描述

oerr ora 01400
01400, 00000, "cannot insert NULL into (%s)"
// *Cause: An attempt was made to insert NULL into previously listed objects.
// *Action: These objects cannot accept NULL values.
SQL> insert into test1(id, col) values(1);
insert into test1(id, col) values(1)
                           *
ERROR at line 1:
ORA-00947: not enough values


SQL> insert into test1(id) values(1);

1 row created.

SQL> select * from test1;

        ID COL
---------- --------------------------------
         1 DEF

在这里插入图片描述

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐