Oracle 12c - No need to create sequences.
Use the below highlighted syntax to auto generate Sequences in Oracle 12c.
CREATE TABLE ABC (
abc_id NUMBER GENERATED BY DEFAULT AS IDENTITY NOT NULL,
name VARCHAR2(50)
)
ALTER TABLE ABC ADD CONSTRAINT abc_id_pk PRIMARY KEY ( abc_id );
Note: In case you are passing the value for primary key manually, Oracle won't generate the sequence for that transaction and will start from the same number where it left last time irrespective of manual insertion.
Use the below highlighted syntax to auto generate Sequences in Oracle 12c.
CREATE TABLE ABC (
abc_id NUMBER GENERATED BY DEFAULT AS IDENTITY NOT NULL,
name VARCHAR2(50)
)
ALTER TABLE ABC ADD CONSTRAINT abc_id_pk PRIMARY KEY ( abc_id );
Note: In case you are passing the value for primary key manually, Oracle won't generate the sequence for that transaction and will start from the same number where it left last time irrespective of manual insertion.
No comments:
Post a Comment