Chinaunix首页 | 论坛 | 博客
  • 博客访问: 703749
  • 博文数量: 147
  • 博客积分: 6010
  • 博客等级: 准将
  • 技术积分: 1725
  • 用 户 组: 普通用户
  • 注册时间: 2008-08-22 10:36
文章分类

全部博文(147)

文章存档

2011年(1)

2010年(1)

2009年(35)

2008年(110)

我的朋友

分类: Oracle

2008-11-13 23:36:57

建表:

create table test
(id number not null primary key,
 name varchar2 not null);

序列:

create squence add1
increment by 1
start with 1
nomaxvalue
nocycle;

触发器:

create Trigger trigger_ranran
before insert on test
for each row
begin
select add1.next.val into :new.ID from dual;
end;

插入语句的时候id就会自动增加1

阅读(747) | 评论(0) | 转发(0) |
0

上一篇:comparator和comparable

下一篇:java正则表达式

给主人留下些什么吧!~~