A vector (heterogeneous array) of as many elements as there were arguments containing copies of the arguments.
vector returns a new vector (one-dimensional array) constructed from the given arguments.
SQL clients can not process vectors directly so the simplest way to look at the content of a vector is to print it no server's console.
dbg_obj_print (vector (1, 2.34, 'A string', atof('3.14')))
The following function gets a heterogenious vector of strings, nubers and other vectors and returns a string that is an SQL expression that will return a copy of a given vector.
create procedure DUMP_VEC_IMPL (inout _vec any, inout _ses any)
{
declare _len, _ctr integer;
if (193 <> __tag (_vec))
{
if (isstring (_vec))
http (WS.WS.STR_SQL_APOS (_vec), _ses);
else
http (cast (_vec as varchar), _ses);
return;
}
_len := length (_vec);
_ctr := 0;
http ('\nvector (', _ses);
while (_ctr < _len)
{
if (_ctr > 0)
http (', ', _ses);
DUMP_VEC_IMPL (_vec[_ctr], _ses);
_ctr := _ctr+1;
}
http (')', _ses);
}
create function DUMP_VEC (in _vec any)
{
declare _ses any;
_ses := string_output();
DUMP_VEC_IMPL (_vec, _ses);
return string_output_string (_ses);
}
select DUMP_VEC (vector ('abc', 1, vector (3.1415), vector ()));
callret
VARCHAR
_______________________________________________________________________________
vector ('abc', 1,
vector (3.1415),
vector ())
1 Rows.