The default auto-Growth of primary keys in Oracle many times when database-related operations are performed, primary keys cannot be filled by users or when multiple users operate on one table at the same time, we need to strictly control the primary key. Here we will focus on how to achieve auto-growth of the primary key in Oracle. Www.2cto.com consists of three steps: 1) create a table; 2) create a sequence; 3) create a trigger (to enable the sequence generated value when inserting data in a table ), 1) create a database table: drop table TEST; create table TEST (bsm NUMBER (10) not null, xh NUMBER (10 ), posx NUMBER (15, 5), posy NUMBER (15, 5); alter table TEST add constraint PK_TEST primary key (BSM); 2) create a sequence drop sequence TEST_SEQ; create sequence TEST_SEQ minvalue 1 maxvalue 999999999999999999 start with 1 increment by 1 cache 20; Note: create a sequence with a minimum value of 1, count from 1 and increase each time as 1; 3) CREATE a trigger www.2cto.com drop TRIGGER test_trig; create or replace trigger "test_trig" before insert on test referencing old as old new as new for each row declare begin select TEST_SEQ.NEXTVAL INTO: NEW. bsm from dual; END test_trig