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 14-12 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.