[Oracle] 시퀀스(Sequence)
캐떠린
시퀀스(Sequence) 데이터베이스 객체 중 하나 오라클 전용 객체(다른 DBMS 제품에는 없음) 일련번호를 생성하는 객체(★★) (주로) 식별자(일련번호)를 만드는데 사용한다. → PK 값으로 사용한다. 시퀀스 객체 생성 1. 간단 ver. create sequence 시퀀스명; 2. Full ver. create sequence 시퀀스명 -- full ver. increment by n--증감치(양수/음수) start with n --시작값(Seed) maxvalue n --최댓값 minvalue n --최솟값 cycle --순환 cache n; 시퀀스 객체 삭제 drop sequence 시퀀스명; 시퀀스 객체 사용(함수) 시퀀스명.nextVal : 호출 시 나올 다음 숫자를 반환 시퀀스명.curr..