Recent projects in Oracle have encountered a number of problems, such as adding self-added columns to Oracle tables, unlike SQL Server, because they have not previously been exposed to Oracle's development.
Oracle does not have functionality such as a self-increment field, but it can be implemented through triggers (trigger) and sequences (sequence).
Build a test table first:
CREATE TABLE Userlogin
(
ID Number (6) is not NULL,
Name VARCHAR2 (+) NOT NULL primary key
)
Tablespace users
/
First step: Create sequence
Create sequence Userlogin_seq increment by 1 start with 1 minvalue 1 maxvalue 9999999999999 nocache order;
Step two: Create a before insert trigger based on the table, using the sequence you just created in the trigger
Create or Replace Trigger Userlogin_trigger
Before insert on Userlogin
For each row
Begin
Select Userlogin_seq.nextval into:new.id from Sys.dual;
End
/
Step three: Test in the Userlogin table
Write an INSERT statement, insert a record, see the ID field has been increased since the increase is OK.
Oracle self-Increment column creation method