Monday, May 4, 2009

Create Sequence Pl/Sql

Sequence is usually used to generate unique primary key values for a relational database table.

Because a sequence is an independent db object, it is created and used independent of a database table.

Same sequence can be used for different tables.

The following statement creates the sequence visitor_seq.
CREATE SEQUENCE VISITOR_SEQ
  INCREMENT BY 1
  START WITH 1
  MINVALUE 1
  MAXVALUE 9999999999
  NOCYCLE
  NOORDER
  ; 

In order to drop previously created sequence issue following pl/sql statement.


DROP SEQUENCE VISITOR_SEQ;

No comments:

Post a Comment