GET_VALUE_AS_VARCHAR2 Function

This function can be used if you use GET_DATA2 to read the column values along with their original data types. It will convert and return the passed in p_value as VARCHAR2.

Syntax

function get_value_as_varchar2 (
   p_data_type in varchar2,
   p_value in t_value,
   p_format_mask in varchar2 default null )
   return varchar2;

Parameters

Table 28-31 GET_VALUE_AS_VARCHAR2 Function Parameters

Parameter Description

p_data_type

The data type of the value stored in p_value.

p_value

The value of type t_value which contains the value to be converted and returned as VARCHAR2.

p_format_mask

The format mask used to convert the value into a VARCHAR2.

Example

The following example emits all values stored in the data type aware l_column_value_list array as VARCHAR2.

declare
  l_column_value_list apex_plugin_util.t_column_value_list2;
begin
    -- Populate l_column_value_list by calling apex_plugin_util.get_data2
    ...
    -- Emit returned data
    sys.htp.p( '<table>' );
    for l_row in 1 .. l_column_value_list( 1 ).value_list.count
    loop
        sys.htp.p( '<tr>' );
        for l_column in 1 .. l_column_value_list.count loop
            sys.htp.p (
                '<td>' ||
                apex_plugin_util.get_value_as_varchar2 (
                    p_data_type => l_column_value_list( l_column ).data_type,
                    p_value => l_column_value_list( l_column ).value_list( l_row )
                    ) ||
                '</td>' );
        end loop;
        sys.htp.p( '</tr>' );
    end loop;
    sys.htp.p( '</table>' );
end;