Oracle table Creation
Create table BI_MLK_SEARCHKEYWORD (
Id number (30) primary key,
KEYWORD varchar2 (30 ),
Times number (30) not null,
Inputdate date,
PINYIN VARCHAR2 (50 ),
FIRSTPINYIN VARCHAR2 (30 ),
ENGLISH VARCHAR2 (50)
);
Oracle creation Sequence
Drop sequence dectuser_tb_seq;
Create sequence dectuser_tb_seq minvalue 1 maxvalue 99999999
Increment by 1
Start with 1;/* The step size is 1 */
Add auto-incrementing sequence to a table
Create or replace trigger dectuser_tb_tri
Before insert on BI_MLK_SEARCHKEYWORD/* trigger condition: This trigger is triggered when the insert operation is performed on the dectuser table */
For each row/* checks whether each row is triggered */
Begin/* trigger start */
Select dectuser_tb_seq.nextval into: new. ID from dual;/* trigger topic content, that is, the action executed after the trigger, where the next value of the obtained sequence dectuser_tb_seq is inserted into the userid field in the dectuser table */
End;
Commit;