Tuesday, 7 June 2016

How to create Sequence in Oracle


Please use the below query to create sequence in Oracle. Here
MAXVALUE  -  denotes the maximum value that can be accoomdated
CACHE  - number of the values that will be created whenever nextval call is done and then put in cache
START WITH   -  the value that will begin with
INCREMENT BY   -  the incremental value

CREATE SEQUENCE <schema_name>.<sequence_name>
  MINVALUE 1
  MAXVALUE 99999999999
  START WITH 1
  INCREMENT BY 1
  CACHE 20;

ex:
CREATE SEQUENCE  TR.TRAVEL_DETAIL_ID_SEQ
  MINVALUE 1
  MAXVALUE 999999999999999999999
  START WITH 1
  INCREMENT BY 1
  CACHE 20;

No comments:

Post a Comment