Try it here
Subscribe
Sequence in Oracle 12C

Sequence can be used as Default value

sequence_can_be_used_as_default_value

Before Oracle 12c we couldn't have sequence as default value for a column, but now we can use sequence as default value as sequence.nextval.

When new row is added, sequence automatically increments and writes the column.

Below is the example:

Create sequence seq_t
start with 1 
increment 1 
nocycle;

Create table t_my_tab (id number default seq_t.nextval primary key)

Writer profile pic

Uk01 on Jan 02, 2015 at 12:01 am


If you like dEexams.com and would like to contribute, you can write your article here or mail your article to admin@deexams.com . See your article appearing on the dEexams.com main page and help others to learn.



Post Comment

Comments( 1)

Commenter Profilr Pic

Anonymous on Jan 02, 2019 at 12:00 am

Wow..my favorite one...Thanks oracle..


×

Forgot Password

Please enter your email address below and we will send you information to change your password.