Home  >  Article  >  Backend Development  >  How to implement a function similar to automatically increasing ID in Oracle?_PHP Tutorial

How to implement a function similar to automatically increasing ID in Oracle?_PHP Tutorial

WBOY
WBOYOriginal
2016-07-13 17:00:53651browse

We often use an ID automatically assigned by the system as our primary key when designing a database, but there is no such function in ORACLE. We
can implement the function of automatically adding IDs by taking the following functions
1. First create sequence
create sequence seqmax increment by 1
2. Use the method
select seqmax.nextval ID from dual
to get an ID
If you put this statement in the trigger, You can achieve the same function as ms sql's automatic ID increase!


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/631208.htmlTechArticleWe often use an ID automatically assigned by the system as our primary key when designing the database, but in ORACLE There is no such function, we can implement it by taking the following function...
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