我们经常在设计数据库的时候用一个系统自动分配的ID来作为我们的主键,但是在ORACLE 中没有这样的 功能,我们
可以通过采取以下的功能实现自动增加ID的功能
1.首先创建 sequence
create sequence seqmax increment by 1
2.使用方法
select seqmax.nextval ID from dual
就得到了一个ID
如果把这个语句放在 触发器中,就可以实现 和 ms sql 的自动增加ID相同的功能!
Leave a Reply
Using Gravatars in the comments - get your own and be recognized!
XHTML: These are some of the tags you can use: <a href=""> <b> <blockquote> <code> <em> <i> <strike> <strong>