It appears that there is no concept of AUTO_INCREMENT in Oracle, up until and including version 11g.
How can I create a column that behaves like auto increment in Or
Trigger
and Sequence
can be used when you want serialized number that anyone can easily read/remember/understand. But if you don't want to manage ID Column (like emp_id) by this way, and value of this column is not much considerable, you can use SYS_GUID()
at Table Creation to get Auto Increment like this.
CREATE TABLE
(emp_id RAW(16) DEFAULT SYS_GUID() PRIMARY KEY,
name VARCHAR2(30));
Now your emp_id
column will accept "globally unique identifier value".
you can insert value in table by ignoring emp_id column like this.
INSERT INTO (name) VALUES ('name value');
So, it will insert unique value to your emp_id
Column.