24.23 GET_COLUMN_POSITION Function

This function returns the array index for a given column alias. In order to do this lookup operation only once, Oracle recommends you to use GET_COLUMN_POSITION function before entering the NEXT_ROW loop. This saves on computing resources.

Syntax

FUNCTION GET_COLUMN_POSITION (
    p_context           IN t_context, 
    p_column_name       IN VARCHAR2,
    p_attribute_label   IN VARCHAR2  DEFAULT NULL,
    p_is_required       IN BOOLEAN   DEFAULT FALSE,
    p_data_type         IN VARCHAR2  DEFAULT c_data_type_varchar2 )
    RETURN PLS_INTEGER;

Parameters

Table 24-18 GET_COLUMN_POSITION Function Parameters

Parameter Description

p_context

Context object obtained with one of the OPEN_ functions.

p_attribute_label

Attribute label to format error messages.

p_column_name

Column name.

p_is_required

Indicates whether this is a required column.

p_data_type

Indicates the requested data type.

Returns

The position of the column in the query result set. Throws an exception when p_is_required or p_data_type prerequisites are not met.