VECTOR_CHUNKS
Use VECTOR_CHUNKS to split plain text into smaller chunks to generate vector embeddings that can be used with vector indexes or hybrid vector indexes.
Syntax

Description of the illustration vector_chunks.gif
chunks_table_arguments::=

Description of the illustration chunks_table_arguments.gif
chunking_spec::=

Description of the illustration chunking_spec.gif
split_characters_list::=

Description of the illustration split_characters_list.gif
custom_split_characters_list

Description of the illustration custom_split_characters_list.gif
normalization_spec

Description of the illustration normalization_spec.gif
custom_normalization_spec

Description of the illustration custom_normalization_spec.gif
normalization_mode

Description of the illustration normalization_mode.gif
chunking_mode::=

Description of the illustration chunking_mode.gif
Purpose
VECTOR_CHUNKS takes a character value as the text_document argument and splits it into chunks using a process controlled by the chunking parameters given in the optional chunking_spec. The chunks are returned as rows of a virtual relational table. Therefore, VECTOR_CHUNKS can only appear in the FROM clause of a subquery.
The returned virtual table has the following columns:
-
CHUNK_OFFSETof data typeNUMBERis the position of each chunk in the source document, relative to the start of the document, which has a position of 1. -
CHUNK_LENGTHof data typeNUMBERis the length of each chunk. -
CHUNK_TEXTis a segment of text that has been split off from text_document.
The data type of the CHUNK_TEXT column and the length unit used by the values of CHUNK_OFFSET and CHUNK_LENGTH depend on the data type of text_document as listed in the following table:
Table 20 Input and Output Data Type Details
| Input Data Type | Output Data Type | Offset and Length Unit |
|---|---|---|
VARCHAR2 |
VARCHAR2 |
byte |
CHAR |
VARCHAR2 |
byte |
CLOB |
VARCHAR2 |
character |
NVARCHAR2 |
NVARCHAR2 |
byte |
NCHAR |
NVARCHAR2 |
byte |
NCLOB |
NVARCHAR2 |
character |
<div class="infoboxnote" markdown="1">
**Note:**
- For more information about data types, see *[Data Types](/pls/topic/lookup?ctx=en/database/oracle/oracle-database/26/sqlrf&id=SQLRF-GUID-A3C0D836-BADB-44E5-A5D4-265BA5968483)* in the SQL Reference Manual.
- The `VARCHAR2` input data type is limited to `4000` bytes unless the `MAX_STRING_SIZE` parameter is set to `EXTENDED`, which increases the limit to `32767`.
</div>
Parameters
All chunking parameters are optional, and the default chunking specifications are automatically applied to your chunk data.
When specifying chunking parameters for this API, ensure that you provide these parameters only in the listed order.
Table 21 Chunking Parameters Table
| Parameter | Description and Acceptable Values |
|---|---|
BY |
Specifies the mode for splitting your data, that is, to split by counting the number of characters, words, or vocabulary tokens. Valid values:
Default value: |
MAX |
Specifies a limit on the maximum size of each chunk. This setting splits the input text at a fixed point where the maximum limit occurs in the larger text. The units of Valid values:
Default value: |
SPLIT [BY] |
Specifies where to split the input text when it reaches the maximum size limit. This helps to keep related data together by defining appropriate boundaries for chunks. Valid values:
|