728x90
728x90
sequence
-
auto incrementOracle 2020. 12. 9. 10:42
oracle 은 mysql 과는 다르게 auto increment 를 지원하지 않는다 auto increment 를 하기 위해서는 SEQUENCE 를 사용해야한다 create sequence topic_seq start with 1 increment by 1; use example insert into topic values(topic_seq.nextval, '새로운 글' || topic_seq.nextval, '새로운 내용입니다', sysdate); topic_seq.nextval 으로 사용하면된다 - 시퀀스명.NEXTVAL : 사용가능한 다음 시퀀스값 반환 - 시퀀스명.CURRVAL : 현재 시퀀스값을 반환