Oracle Identity Column

An Identity column auto increments on input, introduced from Oracle 12C, it’s a useful for the surrogate primary key column.

Syntax:

GENERATED [ ALWAYS | BY DEFAULT [ ON NULL ] ] AS IDENTITY [ ( identity_options ) ]

create table FAQS
(id number(10) GENERATED ALWAYS AS IDENTITY START WITH 1, faq varchar (1000))
;

// add a primary key constraint

ALTER TABLE FAQS
ADD PRIMARY KEY (id);

Author: Labanish

I am in the field of IT, currently working as a cloud architect. I have experience living and working abroad, spent some years in Romania, then relocated to the UK for work. In my spare time, you will find me biking or hiking, exploring new cities or watching my favorite sport, F1. The views expressed here are mine and do not associate to any organization. Laban.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: