create a sequence
create sequence db_id_test_seq
Sequence created.
create a table defaulting to a sequence
create table db_12c_style_identity
(
id integer DEFAULT ON NULL db_id_test_seq.nextval primary key,
another_column varchar2(30)
)
Table created.
insert into db_12c_style_identity (another_column) values ('hello')
1 row(s) inserted.
select * from db_12c_style_identity
| ID | ANOTHER_COLUMN |
|---|---|
| 1 | hello |
insert into db_12c_style_identity (id, another_column) values (22, 'hello')
1 row(s) inserted.
select *
from db_12c_style_identity
| ID | ANOTHER_COLUMN |
|---|---|
| 1 | hello |
| 22 | hello |
insert into db_12c_style_identity (id, another_column) values (null, 'goodbye')
1 row(s) inserted.
select * from db_12c_style_identity
| ID | ANOTHER_COLUMN |
|---|---|
| 1 | hello |
| 22 | hello |
| 2 | goodbye |