VECTOR

Purpose

VECTOR is a contructor that takes a string of type VARCHAR2 or CLOB as input and returns a vector as output.

VECTOR is synonymous with TO_VECTOR.

Parameters

  • expr must evaluate to a vector or a string that represents a vector. The function returns NULL if expr is NULL.

    The string representation of the vector must be in the form of an array of non-null numbers enclosed with a bracket and separated by commas, such as [1, 3.4, -05.60, 3e+4]. TO_VECTOR converts a valid string representation of a vector to a vector in the format specified. If no format is specified the default format is used.

  • number_of_dimensions must be a numeric value that describes the number of dimensions of the vector to construct. The number of dimensions may also be specified as an asterisk (*), in which case the dimension is determined by expr.

  • format must be one of the following tokens: INT8, FLOAT32, FLOAT64, or *. This is the target internal storage format of the vector. If * is used, the format will be FLOAT32.

    Note that this behavior is different from declaring a vector column. When you declare a column of type VECTOR(3, *), then all inserted vectors will be stored as is without a change in format.

Note:

Applications using Oracle Client 23ai libraries or Thin mode drivers can insert vector data directly as a string or a CLOB. For example:

INSERT INTO vecTab VALUES ('[1.1, 2.9, 3.14]');