Description

Creates a Btree, Cross Reference, or Relational index for a specified column in a table. The type of index you create dictates the calling syntax.

Syntax

equ BTREETYPE$ to 1 Create_Index(BTREETYPE$tablename, columnname, casemode, createmode)

equ CROSSREFTYPE$ to 2 Create_Index(CROSSREFTYPE$tablename, columnname, casemode, createmode, delimiterlist, stoplist)

equ RELATIONALTYPE$ to 3 Create_Index(RELATIONALTYPE$tablename, columnname, casemode, createmode, desttable, destcolumn, sortmode)

Parameters

The Create_Index subroutine has the following parameters; the first five parameters are identical regardless of the type of index you create. Parameters that differ by index type are defined separately in the sections that follow.

ParameterDescription
indextype

The value of this parameter specifies the type of index you create.

ValueDescription
1Btree.
2Cross Reference.
3Relational.
tablenameThe name of the table to index.
columnnameThe name of the column to index.
casemode

The case sensitivity of the index.

ValueDescription
0Creates an index that is not case-sensitive. All values are converted to uppercase in the index.
1Creates a case-sensitive index. No case conversion is applied. Uppercase values saved to the index are stored in uppercase, and lowercase values saved to the index are stored in lowercase.
createmode

Specifies whether to build the indexes immediately or process them at a later time.

ValueDescription
0Build the index at a later time, using the Update_Index stored procedure.
1Build the index immediately.

See Also

Cross Reference indexesRelational indexesBtree indexes

Example

The following examples show how to create indexes, programmatically.

declare subroutine Create_Index
declare function Get_Status
/* Create a Btree index on the column PART_NAME in the table CAR_PARTS. 
Values in the index are not converted to uppercase. Indexes are not updated immediately. 
The system stored procedure Update_Index can be run at a later time to update the indexes. */
Create_Index("1", "CAR_PARTS", "PART_NAME", "1", "0")
if Get_Status(ErrCodes) then
  GoSub ErrorHandling
end
/* Creates a Cross Reference index on the column TYPE_DESC in the CAR_PART_TYPES table. 
All values in the index are converted to uppercase. The indexes are built immediately. 
Delimiter_list is a space and a value mark. 
The default stop_list is used and two additional words are added to the default list: PRICE and DESCRIPTION. */
DelimiterList = "SPACE":@fm:"VM"
StopList = "2":@fm:"PRICE":@vm:"DESCRIPTION"
Create_Index("2", "CAR_PART_TYPES", "TYPE_DESC", "0", "1",|
             DelimiterList, StopList)
/* Creates a Relational index between the CAR_PARTS table and the ORDER_INFO table. 
Information in the indexes is converted to uppercase. 
The index is built immediately. The sort mode for the index is TOP. */
Create_Index("3", "CAR_PARTS", "ORDER_PLACE", "0", "1",| "ORDER_INFO", "PARTS", "1")
  • No labels