Home  >  Article  >  php教程  >  如何在Oracle 中实现类似自动增加 ID 的功能?

如何在Oracle 中实现类似自动增加 ID 的功能?

WBOY
WBOYOriginal
2016-06-13 10:04:46875browse

我们经常在设计数据库的时候用一个系统自动分配的ID来作为我们的主键,但是在ORACLE 中没有这样的 功能,我们
可以通过采取以下的功能实现自动增加ID的功能
1.首先创建 sequence
create sequence seqmax increment by 1
2.使用方法
select seqmax.nextval ID from dual
就得到了一个ID
如果把这个语句放在 触发器中,就可以实现 和 ms sql 的自动增加ID相同的功能!


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn