drop table book;
create table book(
bookId varchar2(4) primary key,
name varchar2(20)
);
create sequence book_seq start with 1 increment by 1;
create or replace trigger book_trigger
before insert on book
for each row
begin
select book_seq.nextval into :new.bookId from dual;
end ;
insert into book(name) values ('cc');
insert into book(name) values ('dd');
commit;
posted on 2010-11-29 09:46
孤飞燕 阅读(212)
评论(0) 编辑 收藏 所属分类:
数据库