INDEX_COL function [System]

Function

Returns the name of the indexed column.

Syntax

INDEX_COL ( table-name, index-id, key_# [, user-id ] )

Parameters

table-name A table name.

index-id The index ID of an index of table-name.

key_# A key in the index specified by index-id. This parameter specifies the column number in the index. For a single column index, key_# is equal to 0. For a multicolumn index, key_# is equal to 0 for the first column, 1 for the second column, and so on.

user-id The user ID of the owner of table-name. If user-id is not specified, this value defaults to the caller’s user ID.

Examples

The following statement returns the indexed column name id, which is the first column of the multicolumn index with index-id equal to 6:

SELECT INDEX_COL( 'sales_order_items', 6, 0)

The following statement returns the indexed column name line_id, which is the second column of the multicolumn index with index-id equal to 6:

SELECT INDEX_COL( 'sales_order_items', 6, 1)

The following statement returns the indexed column name file_id, which is the only column in the single column index with index-id equal to 1:

SELECT INDEX_COL( 'ul_statement', 1, 0, 3)

The following statement returns the indexed column name quantity, which is the only column in the single column index with index-id equal to 4:

SELECT INDEX_COL( 'sales_order_items', 4, 0, 1)

Standards and compatibility

See also

“OBJECT_ID function [System]”