Preparing the Data
Agentic AI for Oracle AI Database Professional · Lesson 11 of 20 · 1:18:35
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.
Subscribe on YouTube (opens in a new tab)In this lesson
Prepare for the Agentic AI for Oracle AI Database Professional exam (1Z0-1159-26). In this lesson: turning documents into text with UTL_TO_TEXT, chunking with VECTOR_CHUNKS and UTL_TO_CHUNKS, the chunking parameters (size, split, overlap), and embedding the chunks with UTL_TO_EMBEDDINGS. 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.
Thirty thousand manuals
Ambergate stores thirty thousand repair manuals as files in a table, in PDF, Word, and HTML formats. Before any RAG answer, they must become clean chunks and vectors, without leaving the database. This lesson covers turning documents into text, chunking, the chunking parameters, and embedding the chunks.
From documents to text
The DBMS_VECTOR_CHAIN package offers a chain of utility functions, one for each step of the preparation. The first one, UTL_TO_TEXT, pulls plain text from documents like PDF, Word, HTML, JSON, or XML files, using Oracle Text. Its output can feed the next step directly, in the same statement.
Chunking
Chunking splits the text into pieces that are small enough for the embedding model. In SQL, the VECTOR_CHUNKS function does it, and in PL/SQL, the UTL_TO_CHUNKS function does the same work, and returns JSON. A chunk that is too long is cut at the model's token limit, and the extra text is simply lost. A chunk that is too short scatters the meaning, so the size of the chunks matters.
Chunking parameters
The by clause sets the unit: characters, words, which is the default, or vocabulary, which counts the tokens of a model's vocabulary. Max sets the size of a chunk in that unit, with a default of one hundred. Split sets where a chunk may end: on new lines, blank lines, spaces, sentences, custom strings, or recursively, which is the default, trying blank lines, then new lines, then spaces. Overlap repeats some text from the end of one chunk at the start of the next, to keep the context, and five to twenty percent of max is a common choice. Normalize cleans up punctuation and white space, and language sets the rules for sentences and abbreviations.
Embedding the chunks
Then UTL_TO_EMBEDDINGS turns an array of chunks into an array of embeddings, each with an ID, the chunk text, and its vector. Its parameters name the provider: the database itself, with an ONNX model already loaded, or an external provider, with a credential. Each chunk sent to it is limited to four thousand characters. And the steps can be chained in one statement: text, then chunks, then embeddings, then an insert into the vector table.
Recap
Let's recap. DBMS_VECTOR_CHAIN chains utility functions, and UTL_TO_TEXT pulls plain text from documents. VECTOR_CHUNKS in SQL and UTL_TO_CHUNKS in PL/SQL split the text, and chunks that are too long lose text at the token limit. By, max, and split set the unit, the size, and where chunks end, with recursive splitting by default. Overlap keeps context across chunk edges, and normalize and language refine the result. And UTL_TO_EMBEDDINGS embeds the chunks, with the database provider or an external one, in a single chained statement.
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.
Ambergate’s embedding model accepts 512 tokens, but some chunks are three times longer. What happens to them when they are embedded?
- The model splits each one into three vectors
- The text past the limit is lost
- The database rejects the whole batch of chunks
- Their vectors get three times more dimensions
Show the answer
The text past the limit is lost
The model only reads up to its token limit, so the rest of each long chunk is lost, and never reaches the vector. “The model splits each one into three vectors” is wrong, since the model returns one vector for each input, and it does not split anything. “The database rejects the whole batch of chunks” is wrong, because the embedding still succeeds, which is why the loss goes unnoticed. And “Their vectors get three times more dimensions” is wrong, since the number of dimensions is fixed by the model.
Ambergate’s chunks often cut sentences in half, and answers lose the context at the edge of a chunk. Which settings help most?
- SPLIT BY SENTENCE, with an OVERLAP
- BY CHARACTERS, with a MAX of only 50
- NORMALIZE ALL, with no overlap at all
- SPLIT BY NONE, with a smaller MAX
Show the answer
SPLIT BY SENTENCE, with an OVERLAP
Splitting by sentence keeps sentences whole, and an overlap carries the context across chunk edges. “BY CHARACTERS, with a MAX of only 50” makes the chunks even smaller, which scatters the meaning further. “NORMALIZE ALL, with no overlap at all” cleans the text, but without an overlap, the edge context is still lost. And “SPLIT BY NONE, with a smaller MAX” splits nowhere but at the size limit, so it cuts even more sentences.
Ambergate wants to embed its chunks inside the database, with no call to any outside service. What should the parameters of UTL_TO_EMBEDDINGS name?
- The OCI Generative AI provider and a credential
- The database provider, with no model
- The database provider and a loaded model
- An outside provider and its API key
Show the answer
The database provider and a loaded model
The database provider, with an ONNX model already loaded, computes the embeddings without any outside call. “The OCI Generative AI provider and a credential” sends the chunks to an outside service. “The database provider, with no model” names the right provider, but the database still needs a model to run. And “An outside provider and its API key” also calls a service outside the database.