id in oracle code example
Example 1: oracle create table auto generated primary key
create table t1 (
c1 NUMBER GENERATED by default on null as IDENTITY,
c2 VARCHAR2(10)
);
create table t1 (
c1 NUMBER GENERATED ALWAYS as IDENTITY(START with 1 INCREMENT by 1),
c2 VARCHAR2(10)
);
Example 2: pl sql create table identity column
Copy
sql-> CREATE Table sg_atts (
id INTEGER GENERATED ALWAYS AS IDENTITY
(START WITH 2
INCREMENT BY 2
MAXVALUE 200
NO CYCLE),
name STRING,
PRIMARY KEY (id));
Statement completed successfully
sql->