Tuesday, February 19, 2008

Query to create sequence of the following pattern 1,2 ,1,2,1,2… :

The following query will create sequence that will generate 1 and 2 continuously.

 

            CREATE SEQUENCE seq1 START WITH 1 INCREMENT BY 1 MAXVALUE 2 CYCLE NOCACHE.

 
The NOCACHE is the key to this query and it is mandatory. If the nocache is not mentioned it will throw an error.
 
 The default value for cache is 20.

 

  If the cache value is to mention in the statement, then it should satisfy the following two conditions:

 

1)      The cache value should be greater than 1.

2)      The cache value should be less than (MAXVALUE – MINVALUE).

 

No comments:

Powered By Blogger