oracle创建表
create table country (
id number not null ,
countryname varchar(255) ,
countrycode varchar(255),
primary key(id)
);
创建序列
create sequence country_id_seq; --创建序列
创建触发器
create or replace trigger test_id
before insert on country
for each row
begin
select country_id_seq.nextval into :new.id from dual;
end;
插入数据
insert into country(countryname,countrycode) values('中国','CN');
insert into country(countryname,countrycode) values('美国','US');
insert into country(countryname,countrycode) values('俄罗斯','RU');
insert into country(countryname,countrycode) values('英国','GB');
insert into country(countryname,countrycode) values('法国','FR');