Creating a Vector from a String
The string representation of a Vector is a comma-separated list of coordinates, all enclosed in square brackets.
For example, a value of type Vector (3, INT) can be represented as a string as follows:
[1,2,3]
A Vector value may be constructed from a string using the following SQL syntax:
Vector('<value>', <dimension>, <coordinate type>)
• The <value> must follow the representation described above; each coordinate must be valid for its type, and the total number of coordinates must match the specified dimension.
• <dimension> and <coordinate type> specify the dimension and the coordinate type of the Vector value to be constructed.
For example:
CREATE TABLE myintvectortable(v1 vector(10, INT));
INSERT INTO myintvectortable VALUES (
VECTOR('[0, -1, 2, -3, 4, -5, 6, -7, 8, -9]', 10, INT)
);
In this case, the Vector(…) cast from the string is not strictly required, because the destination column type is known. So this will give the same result:
INSERT INTO myintvectortable VALUES (
'[0, -1, 2, -3, 4, -5, 6, -7, 8, -9]'
);
Last modified date: 09/11/2026