Improved Defaults 增强了DEFAULT, default目前可以直接指代sequence了,同时增强了default充当identity的能力
Oracle Database 12c Release 1 implements ANSI-compliant IDENTITY
columns. Migration from database systems that use identity columns is simplified and can take advantage of this new functionality.
This feature implements auto increment by enhancing DEFAULT
or DEFAULT ON NULL
semantics for use by SEQUENCE.NEXTVAL
and SYS_GUID
, supports built-in functions and implicit return of default values.
SQL> CREATE TABLE t1 (c1 NUMBER GENERATED BY DEFAULT ON NULL AS IDENTITY, c2 VARCHAR2(10));
Table created.
SQL> INSERT INTO t1(c2) VALUES ('abc');
1 row created.
SQL>INSERT INTO t1 (c1, c2) VALUES (null, 'xyz');
SQL> INSERT INTO t1 (c1, c2) VALUES (default,'jkl');
1 row created.
SQL> SELECT c1, c2 FROM t1;
C1 C2
---------- ----------
1 abc
2 xyz
3 jkl
欢迎光临 重庆思庄Oracle、Redhat认证学习论坛 (http://bbs.cqsztech.com/) | Powered by Discuz! X3.2 |