Reputation: 1
Without creating a trigger can we apply auto-increment constraint on a column in oracle sql?
Create a sequence Example:- CREATE SEQUENCE books_seq START WITH 1 INCREMENT BY 1 CACHE 10;
will this be enough to make a column auto-increment without creating a trigger??
Upvotes: 0
Views: 95
Reputation: 142705
If you're on Oracle database version lower then 12c, then trigger is the only way to do that.
If you're on 12c and above, you can create identity column; in background, it is still a sequence, but Oracle does everything for you.
Upvotes: 1