Oracle建表
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建序列
drop sequence dectuser_tb_seq;
create sequence dectuser_tb_seq minvalue 1 maxvalue 99999999
increment by 1
start with 1; /*步长为1*/
给表添加自增序列
create or replace trigger dectuser_tb_tri
before insert on BI_MLK_SEARCHKEYWORD /*触发条件:当向表dectuser执行插入操作时触发此触发器*/
for each row /*对每一行都检测是否触发*/
begin /*触发器开始*/
select dectuser_tb_seq.nextval into :new.ID from dual; /*触发器主题内容,即触发后执行的动作,在此是取得序列dectuser_tb_seq的下一个值插入到表dectuser中的userid字段中*/
end;
commit;