Total Pageviews

October 11, 2016

10/11/2016 01:18:00 PM
Oracle 12c-Identity column

Identity Columns :A column in a table can be marked as identity column which generates its value by itself.
Oracle implicitly creates a sequence of default configuration for the identity column. For each insert operation, the current value of the sequence gets automatically assigned to the identity column. The feature syntax is as below.

SQL> create table t_id ( x number
generated by default as identity
( start with 10 increment by 15 ) primary key,
y varchar2(30))
Table created.
SQL> insert into t _id(x,y) values ( 1, ;'abc' );
1 row created.
SQL> insert into t_id (x,y) values ( default, 'abc1');
1 row created.
SQL> insert into t_id (y) values ( ‘'abc2' );
1 row created.
SQL> select * from t_id;
X                                       Y
——————————  ———————————
1                                      abc
10                                    abc1
25                                    abc2
Related Posts Plugin for WordPress, Blogger...