The get_value_type() function retrieves the value stored in the specified array element.
The name of the function is of the form get_value_type(), where type is the data type of the element to retrieve, for example get_value_varchar(). There are eight data types, but there are two versions of the function for each data type, which you can use to retrieve array elements by index or by name.
The get_value_type() function has the following syntax:
varchar = get_value_varchar(array input, int index);
varchar = get_value_varchar(array input, varchar name);
varchar = get_value_varchar(array input, nvarchar name);
nvarchar = get_value_nvarchar(array input, int index);
nvarchar = get_value_nvarchar(array input, varchar name);
nvarchar = get_value_nvarchar(array input, nvarchar name);
int8 = get_value_int(array input, int index);
int8 = get_value_int(array input, varchar name);
int8 = get_value_int(array input, nvarchar name);
double = get_value_double(array input, int index);
double = get_value_double(array input, varchar name);
double = get_value_double(array input, nvarchar name);
time = get_value_time(array input, int index);
time = get_value_time(array input, varchar name);
time = get_value_time(array input, nvarchar name);
timetz = get_value_time(array input, int index);
timetz = get_value_time(array input, varchar name);
timetz = get_value_time(array input, nvarchar name);
date = get_value_date(array input, int index);
date = get_value_date(array input, varchar name);
date = get_value_date(array input, nvarchar name);
timestamp = get_value_timestamp(array input, int index);
timestamp = get_value_timestamp(array input, varchar name);
timestamp = get_value_timestamp(array input, nvarchar name);
The input value specifies the array that contains the element to retrieve.
The index value specifies the index of the element to retrieve from the input array.
The name value specifies the name of the element to retrieve from the input array.
select get_value_int(col2,1)from array_t;
get_value_int
---------------
12
(1 row)