创建数据表
create table rainquality(
id number(10) primary key,
districtName varchar2(22) not null,
monitorTime date not null,
rain number(10) not null,
monitoringStation varchar2(200) not null,
monitoringAddress varchar2(200) not null
);
创建自动增长序列
create sequence rain_seq
increment by 1 --每次加1个
start with 1
nomaxvalue --不设置最大值
nocycle --一直累加,不循环
cache 10;
创建触发器
create or replace trigger tr_rain
before insert on (rainquality) 括号内写相应的表名
for each row
begin
select rain_seq.nextval into :new.id from dual;
序列名 new.自增长的列名
end;