10.12.2012 Views

Oracle TimesTen In-Memory Database API and SQL Reference Guide

Oracle TimesTen In-Memory Database API and SQL Reference Guide

Oracle TimesTen In-Memory Database API and SQL Reference Guide

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

CREATE SEQUENCE<br />

Access<br />

Control<br />

<strong>SQL</strong><br />

Syntax<br />

The CREATE SEQUENCE statement creates a new sequence number generator<br />

that can subsequently be used by multiple users to generate unique integers. You<br />

use the CREATE SEQUENCE statement to define the initial value of the<br />

sequence, define the increment value, the maximum or minimum value <strong>and</strong><br />

determine if the sequence “cycles.”<br />

If Access Control is enabled for your <strong>TimesTen</strong> instance, this statement requires<br />

DDL privileges.<br />

CREATE SEQUENCE [Owner.]SequenceName<br />

[INCREMENT BY <strong>In</strong>crementValue]<br />

[MINVALUE MinimumValue]<br />

[MAXVALUE MaximumValue]]<br />

[CYCLE]<br />

Parameters The CREATE SEQUENCE statement has the parameters:<br />

SEQUENCE<br />

[Owner.]SequenceName<br />

Name of the sequence number generator<br />

<strong>In</strong>crementValue The incremental value between consecutive numbers. This value can<br />

be either a positive or negative integer. It cannot be 0. If the value is<br />

positive, it is an ascending sequence. If the value is negative, it is<br />

descending. The default value is 1. <strong>In</strong> a descending sequence, the<br />

range starts from MAXVALUE to MINVALUE, <strong>and</strong> vice versa for<br />

ascending sequence.<br />

MINVALUE The starting value for an ascending sequence. The default minimum<br />

value is 1.<br />

MAXVALUE The largest possible value for an ascending sequence, or the starting<br />

value for a descending sequence. The default maximum value is<br />

(2 63 ) -1, which is the maximum of BIGINT.<br />

<strong>SQL</strong> Statements 709

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!