Entering content frame

CREATE INDEX Statement (create_index_statement) Locate the document in its SAP Library structure

The CREATE INDEX statement creates an index of a base table (see table).

Syntax

<create_index_statement> ::=
CREATE [UNIQUE] INDEX <index_name> ON <table_name> (<column_name> [ASC|DESC],...)

table_name, column_name, index_name

Explanation

Indexes provide access to the table data using non-key columns. Maintaining these indexes, however, can be quite complex in the case of an INSERT, UPDATE, or DELETE statement.

The index is created across the specified table columns. The secondary key consists of the specified columns of the table, in the specified order.

·        The specified table must be an existing base table, and not a temporary table. The index name must not be identical with an existing index name of the table.

·        The column defined by the column name must be a column in the specified table. This column must not be a LONG column. All of the column name pairs must be different.

·        The current user must have the INDEX privilege type for the columns.

·        Restrictions

UNIQUE

If UNIQUE is specified, the database system ensures that no two rows of the specified table have the same values in the indexed columns. In this way, if two rows both contain the NULL value for all columns of an index, the two index values are not considered to be identical. If there is not at least one column that does not contain the NULL value, two rows that have the same value in all non-NULL columns are considered to be identical.

ASC | DESC

The index values are stored in ascending or descending order. If the specification of ASC or DESC is omitted, ASC is implicitly assumed.

 

Leaving content frame