MySQL adds auto_increment directly behind the field
Oracle
The main point is 2, the first is to create a sequence name sequence;
Then, when the INSERT statement is placed: the position of the Increment field, written as the sequence name. Nextval.
As explained below, starting with creating a table and then creating a sequence, how to write the INSERT statement, you can implement the field's self-increment process.
1. Create a table first
CREATE TABLE "flowcal". "T_userinfo "
( "c_id "Number (*,0),
"C_user" VARCHAR2 (BYTE),
"C_password" VARCHAR2 (BYTE),
"C_role" VARCHAR2 (BYTE),
"C_comment1" VARCHAR2 (BYTE),
"C_comment2" VARCHAR2 (BYTE)
)
Now I want to make c_id a self-increment.
2. First create an Oracle SEQUENCE,SQL statement as follows:
Create sequence sequence name
Increment by 1
Start with 1
MaxValue 999999999
Cycle
Set up a sequence with a minimum of 1 and a serial number with a maximum of 999999999 to be automatically looped
Here is my sequence, as follows:
CREATE SEQUENCE"Flowcal". " Seq_userinfo "
MINVALUE 0
MAXVALUE 999999999999999999999999 9999
increment by 1
start with 24
cache 20
cycle;
3. sequence name. nextval sql> insertinto table name values (, column 1 value, column 2 value,....);
Here's my insert statement:
INSERT into t_userinfo values (seq_userinfo. Nextval , ' 111 ', ' one ', ' one ', ' one ', ' one ')
below is an image For reference:
Database self-increment implementation