Cert EspressoLearn. Practise. Find your flow.

A LITTLE FOCUS.
A BIG NEXT STEP.

Your pace. Your space.
Oracle · Agentic AI for Oracle AI Database Professional

The VECTOR Data Type and Constructors

Agentic AI for Oracle AI Database Professional · Lesson 3 of 20 · 15:21

YouTube loads only after you press play. This chapter opens at its timestamp in the full course. Watch on YouTube ↗

Learning with these videos? Subscribe for new courses and exam-style questions.

In this lesson

Prepare for the Agentic AI for Oracle AI Database Professional exam (1Z0-1159-26). In this lesson: the VECTOR column, dimension counts and formats (INT8, FLOAT32, FLOAT64, BINARY), dense and sparse vectors, and the TO_VECTOR and FROM_VECTOR constructors. Follows Ambergate Appliances, a fictional appliance maker. Includes three original practice questions.

Study notes

The text of this lesson, to read at your own pace. Information as of November 2026.

Three kinds of vectors

Ambergate's data team now has three kinds of vectors to store: float vectors from its text model, compact INT8 vectors from a partner, and sparse keyword vectors for part numbers. Each kind needs the right column definition, or inserts fail and storage grows for nothing. This lesson covers the vector data type, its formats, dense and sparse storage, and the vector constructors.

The vector column

A vector column takes three optional parts: the number of dimensions, the dimension format, and the storage format. A column declared with one thousand twenty four dimensions and FLOAT32 accepts only vectors of exactly that size, stored as thirty two bit floats. An asterisk leaves a part flexible, and a bare vector column accepts any number of dimensions in any format. The limit is sixty five thousand five hundred thirty five dimensions, and a vector index will later need every vector in the column to have the same number.

Dimension formats

There are four dimension formats. FLOAT32 is the default, and FLOAT64 doubles both the precision and the space. INT8 stores one byte per dimension, a good fit for quantized embeddings from providers like Cohere. BINARY stores one bit per dimension, so the vectors are thirty two times smaller than with FLOAT32, distances are computed up to forty times faster, and accuracy usually stays above ninety percent. A binary vector needs a number of dimensions that is a multiple of eight, its default metric is Hamming, and the database does not quantize vectors for you, since the model or the client does.

Dense and sparse

Vectors are dense by default, which means that every dimension stores a value. Sparse vectors have many dimensions but very few values that are not zero, like the keyword vectors of sparse models such as SPLADE, where each dimension is a word of a vocabulary. A sparse column stores only the values that are not zero, and its text form lists the total dimension count, the positions of those values, and the values themselves. Sparse vectors are good at matching keywords, and they can use HNSW indexes, but not IVF indexes.

Vector constructors

To build a vector from other data, use the TO_VECTOR constructor, or its synonym, VECTOR. It accepts a string in square brackets, a CLOB, a BLOB of raw bytes, a JSON array of numbers, or another vector, whose format it then changes. Optional arguments set the number of dimensions, the format, and dense or sparse storage. One subtle point: in TO_VECTOR, an asterisk for the format means FLOAT32, while a column declared with an asterisk keeps each vector in the format it arrives in.

Read vectors back

FROM_VECTOR turns a vector back into text or a CLOB, and it can return a sparse vector in its dense form. Helper functions describe a vector, like VECTOR_DIMENSION_COUNT for its number of dimensions, and VECTOR_NORM for its length. And with recent client libraries or thin drivers, an application can insert a vector simply as a string, while older clients wrap the string in TO_VECTOR.

Recap

Let's recap. A vector column takes optional dimensions, format, and storage, and an asterisk leaves a part flexible. FLOAT32 is the default, FLOAT64 doubles the space, INT8 uses one byte, and BINARY one bit per dimension. Sparse vectors store only the values that are not zero, with their own text form, and they cannot use IVF indexes. TO_VECTOR, or VECTOR, builds vectors from strings, CLOBs, BLOBs, JSON, or other vectors. And FROM_VECTOR, VECTOR_DIMENSION_COUNT, and VECTOR_NORM read vectors back.

Quick checks for this lesson

The 3 questions of this lesson, as plain text. The button above runs them with shuffled choices and the reason behind every choice.

  1. Ambergate stores 400 million image embeddings, and storage costs keep climbing. A small loss of accuracy is acceptable, and the model can produce one bit per dimension. Which format cuts storage the most?

    • BINARY, one bit per dimension
    • INT8, one byte per dimension
    • FLOAT64, for double precision
    • SPARSE storage of the same floats
    Show the answer

    BINARY, one bit per dimension

    A binary vector uses one bit per dimension, thirty two times less than FLOAT32, usually with a small loss of accuracy. “INT8, one byte per dimension” uses one byte per dimension, so it saves four times, not thirty two. “FLOAT64, for double precision” doubles the storage instead. And “SPARSE storage of the same floats” only helps when most values are zero, which is not the case for these dense embeddings.

  2. A developer inserts a keyword vector into a SPARSE column, but writes it as a plain list of 30,000 numbers, mostly zeros. The insert fails. What should the developer do?

    • Declare the column as FLOAT64
    • Wrap the list in VECTOR_EMBEDDING
    • Write the count, positions, and values
    • Remove the zeros from the plain list first
    Show the answer

    Write the count, positions, and values

    A sparse column needs the sparse text form, with the total dimension count, the positions of the values that are not zero, and the values. “Declare the column as FLOAT64” changes the number format, but the dense text form is still refused. “Wrap the list in VECTOR_EMBEDDING” calls an embedding model, which builds a new vector from text instead of reading this one. And “Remove the zeros from the plain list first” would shrink the list to the wrong number of dimensions.

  3. A column is declared with * as its format, and an app inserts INT8 values as text through TO_VECTOR, with * as the format argument. The team expected INT8 vectors, but finds FLOAT32 vectors. Why?

    • The column converts every vector to FLOAT32
    • TO_VECTOR’s * format means FLOAT32
    • INT8 is not a supported dimension format
    • The vectors exceed the dimension limit
    Show the answer

    TO_VECTOR’s * format means FLOAT32

    In TO_VECTOR, an asterisk for the format produces FLOAT32, so the conversion happens before the insert. “The column converts every vector to FLOAT32” is the opposite of the rule, since a column declared with an asterisk keeps each vector in the format it receives. “INT8 is not a supported dimension format” is wrong, because INT8 is one of the four formats. And “The vectors exceed the dimension limit” would make the insert fail, not change the format.