Install AI Agent Skills  View Python SDK

PL/SQL API Reference

Use this reference to call DBMS_VECTOR_DATABASE package subprograms for vector table, data, search, index, and model operations.

DBMS_VECTOR_DATABASE Package

The DBMS_VECTOR_DATABASE package provides APIs for common Oracle AI Vector Search operations, including vector table management, vector data operations, vector search, index management, and model operations.

These PL/SQL functions accept input parameters in JSON format where noted. The functions return a CLOB that contains the JSON response.

API Impacts

Use this table to understand the effects of each API operation before you call it.

Category API Impacts
Models LOAD_MODEL Adds a model to the current vector user’s schema.
  LIST_MODELS None; read-only.
  DESCRIBE_MODEL None; read-only.
  DROP_MODEL Permanently removes a model from the current vector user’s schema.
Vector Tables SUMMARY None; read-only.
  CREATE_VECTOR_TABLE Creates database objects and managed metadata; commits automatically.
  LIST_VECTOR_TABLES None; read-only.
  DESCRIBE_VECTOR_TABLE None; read-only.
  UPDATE_VECTOR_TABLE_ANNOTATION Replaces the table comment and complete annotations JSON; annotations are not merged. Commits automatically.
  DROP_VECTOR_TABLE Permanently deletes the table, its data, indexes, and managed metadata; commits automatically.
Manage Data GENERATE_EMBEDDING None; read-only.
  LIST_VECTORS None; read-only.
  LOAD_VECTORS Imports vectors, may generate embeddings, and refreshes metadata/statistics; commits automatically.
  UPSERT_VECTORS Inserts or replaces vector records; may generate embeddings; commits automatically.
  DELETE_VECTORS Permanently deletes vector records and refreshes statistics; commits automatically.
Search Data SEARCH None; read-only.
  RERANK None; read-only.
Indexes CREATE_INDEX Creates indexes and updates managed index metadata; commits automatically.
  INDEX_BUILD_STATUS None; read-only.
  REBUILD_INDEX Rebuilds indexes; may affect query performance while running; commits automatically.
  DROP_INDEX Removes indexes and updates managed index metadata; commits automatically.

Models

These functions enable you to manage embedding and reranking models.

Subprograms in this section: DBMS_VECTOR_DATABASE.LOAD_MODEL(), DBMS_VECTOR_DATABASE.LIST_MODELS(), DBMS_VECTOR_DATABASE.DESCRIBE_MODEL(), DBMS_VECTOR_DATABASE.DROP_MODEL().

LOAD_MODEL

Use the DBMS_VECTOR_DATABASE.LOAD_MODEL PL/SQL function to load an ONNX model from cloud storage into the database.

Purpose

Use this function to load a model from a URI. After loading, the function returns the same model detail shape as DESCRIBE_MODEL.

Syntax

DBMS_VECTOR_DATABASE.LOAD_MODEL (
    model_name                  IN VARCHAR2,
    url                         IN VARCHAR2,
    model_params                IN JSON DEFAULT NULL,
    debug_flags                 IN JSON DEFAULT NULL,
    request_id                  IN VARCHAR2 DEFAULT NULL
)return CLOB;

Parameters

Parameter Type Value Range Required Default Description Notes
model_name VARCHAR2 Valid model identifier Yes No default Unique name to assign to the loaded model. Must not already exist in the caller schema.
url VARCHAR2 Object storage URL Yes No default Object storage URL where the model file is located. Required.
model_params JSON Object or NULL No NULL Optional model loading settings for object storage access and model metadata. Use credential when the model URL requires a database credential. Use metadata to pass model metadata, such as {"function": "regression"} for a reranking model.
debug_flags JSON Object or NULL No NULL Debug/tracing flags for detailed logging. Optional unless diagnostics are needed.
request_id VARCHAR2 1-256 effective chars No NULL Correlation ID. Optional.

model_params fields

Field Type Value Range Required Description Notes
credential string Valid credential name No Database credential used to access the object storage URL. Provide when the model URL is private or requires object storage authentication. Omit for public or pre-authenticated URLs.
metadata object Object or NULL No A JSON description of the metadata describing the model. The metadata must, at minimum, describe the machine learning function supported by the model. The model’s metadata parameters are described in JSON Metadata Parameters for ONNX Models. For reranking models, include "function": "regression" in metadata.

Load an embedding model

declare
  out clob;
begin
  out := dbms_vector_database.load_model(
    model_name => 'DOC_EMBED_MODEL',
    url => 'https://objectstorage.example.com/models/doc_embed.onnx'
);
  dbms_vector_database.pretty_print(out);
end;
/

Load a reranking model

declare
  out clob;
begin
  out := dbms_vector_database.load_model(
    model_name => 'RERANK_MODEL',
    url => 'https://objectstorage.example.com/models/reranker_quantized.onnx',
    model_params => JSON('{"metadata": {"function": "regression"}}')
);
  dbms_vector_database.pretty_print(out);
end;
/

Example response

{
  "model_name": "DOC_EMBED_MODEL",
  "algorithm": "ONNX",
  "mining_function": "EMBEDDING",
  "creation_date": "2026-05-01T10:00:00.000000+00:00",
  "attributes": [
    {
      "name": "DATA",
      "value": "TEXT",
      "data_type": "VARCHAR2",
      "data_length": 4000,
      "vector_info": null
    }
  ]
}

LIST_MODELS

Use the DBMS_VECTOR_DATABASE.LIST_MODELS PL/SQL function to list embedding and reranking models available in the caller schema.

Purpose

Use this function to retrieve model metadata, including model name, algorithm, mining function, creation date, and model attributes.

Syntax

DBMS_VECTOR_DATABASE.LIST_MODELS (
    debug_flags                 IN JSON DEFAULT NULL,
    request_id                  IN VARCHAR2 DEFAULT NULL
)return CLOB;

Parameters

Parameter Type Value Range Required Default Description Notes
debug_flags JSON Object or NULL No NULL Debug/tracing flags. Optional.
request_id VARCHAR2 1-256 effective chars No NULL Correlation ID. Optional.

Example

declare
  out clob;
begin
  out := dbms_vector_database.list_models();
  dbms_vector_database.pretty_print(out);
end;
/

Example response

{
  "models": [
    {
      "model_name": "DOC_EMBED_MODEL",
      "algorithm": "ONNX",
      "mining_function": "EMBEDDING",
      "creation_date": "2026-05-01T10:00:00.000000+00:00",
      "attributes": [
        {
          "name": "DATA",
          "value": "TEXT",
          "data_type": "VARCHAR2",
          "data_length": 4000,
          "vector_info": null
        }
      ]
    }
  ]
}

DESCRIBE_MODEL

Use the DBMS_VECTOR_DATABASE.DESCRIBE_MODEL PL/SQL function to retrieve details for a model in the caller schema.

Purpose

Use this function to retrieve model name, algorithm, mining function, creation date, and model attributes for a single model.

Syntax

DBMS_VECTOR_DATABASE.DESCRIBE_MODEL (
    model_name                  IN VARCHAR2,
    debug_flags                 IN JSON DEFAULT NULL,
    request_id                  IN VARCHAR2 DEFAULT NULL
)return CLOB;

Parameters

Parameter Type Value Range Required Default Description Notes
model_name VARCHAR2 Existing model Yes No default Model to describe. Must exist in caller schema.
debug_flags JSON Object or NULL No NULL Debug/tracing flags. Optional.
request_id VARCHAR2 1-256 effective chars No NULL Correlation ID. Optional.

Example

declare
  out clob;
begin
  out := dbms_vector_database.describe_model('DOC_EMBED_MODEL');
  dbms_vector_database.pretty_print(out);
end;
/

Example response

{
  "model_name": "DOC_EMBED_MODEL",
  "algorithm": "ONNX",
  "mining_function": "EMBEDDING",
  "creation_date": "2026-05-01T10:00:00.000000+00:00",
  "attributes": [
    {
      "name": "DATA",
      "value": "TEXT",
      "data_type": "VARCHAR2",
      "data_length": 4000,
      "vector_info": null
    }
  ]
}

DROP_MODEL

Use the DBMS_VECTOR_DATABASE.DROP_MODEL PL/SQL function to drop a model from the caller schema.

Purpose

Use this function to remove a model from the database. Dropping a model can affect integrated embedding vector tables or workflows that depend on it.

Syntax

DBMS_VECTOR_DATABASE.DROP_MODEL (
    model_name                  IN VARCHAR2,
    debug_flags                 IN JSON DEFAULT NULL,
    request_id                  IN VARCHAR2 DEFAULT NULL
)return CLOB;

Parameters

Parameter Type Value Range Required Default Description Notes
model_name VARCHAR2 Existing model Yes No default Model to drop. Must exist in caller schema and must not be referenced by an integrated embedding vector table.
debug_flags JSON Object or NULL No NULL Debug/tracing flags. Optional.
request_id VARCHAR2 1-256 effective chars No NULL Correlation ID. Optional.

Example

declare
  out clob;
begin
  out := dbms_vector_database.drop_model('DOC_EMBED_MODEL');
  dbms_vector_database.pretty_print(out);
end;
/

Example response

{
  "message": "Model DOC_EMBED_MODEL dropped successfully"
}

Vector Tables

These functions enable you to summarize vector database objects and manage vector tables in Database.

Subprograms in this section: DBMS_VECTOR_DATABASE.SUMMARY(), DBMS_VECTOR_DATABASE.CREATE_VECTOR_TABLE(), DBMS_VECTOR_DATABASE.LIST_VECTOR_TABLES(), DBMS_VECTOR_DATABASE.DESCRIBE_VECTOR_TABLE(), DBMS_VECTOR_DATABASE.UPDATE_VECTOR_TABLE_ANNOTATION(), DBMS_VECTOR_DATABASE.DROP_VECTOR_TABLE().

SUMMARY

Use the DBMS_VECTOR_DATABASE.SUMMARY PL/SQL function to retrieve summary counts for vector tables created by DBMS_VECTOR_DATABASE.CREATE_VECTOR_TABLE, their vectors, and models in the caller schema.

Purpose

Use this function to retrieve a compact summary of vector tables managed by DBMS_VECTOR_DATABASE, their vectors, and models for the current user.

Syntax

DBMS_VECTOR_DATABASE.SUMMARY (
    debug_flags                 IN JSON DEFAULT NULL,
    request_id                  IN VARCHAR2 DEFAULT NULL
)return CLOB;

Parameters

Parameter Type Value Range Required Default Description Notes
debug_flags JSON Object or NULL No NULL Debug/tracing flags. Optional.
request_id VARCHAR2 1-256 effective chars No NULL Correlation ID. Optional.

Example

declare
  out clob;
begin
  out := dbms_vector_database.summary();
  dbms_vector_database.pretty_print(out);
end;
/

Example response

{
  "total_tables": 3,
  "total_vectors": 12500,
  "total_models": 2
}

CREATE_VECTOR_TABLE

Use the DBMS_VECTOR_DATABASE.CREATE_VECTOR_TABLE PL/SQL function to create a vector table.

Purpose

Use this function to create either a bring-your-own-vector table or an integrated embedding table. If embed_params is omitted, callers provide vector values directly. If embed_params is supplied, the database uses the configured model and metadata path for text embedding workflows.

Syntax

DBMS_VECTOR_DATABASE.CREATE_VECTOR_TABLE (
    name                        IN VARCHAR2,
    comment                     IN VARCHAR2 DEFAULT NULL,
    annotations                 IN JSON DEFAULT NULL,
    table_params                IN JSON DEFAULT NULL,
    embed_params                IN JSON DEFAULT NULL,
    index_params                IN JSON DEFAULT NULL,
    debug_flags                 IN JSON DEFAULT NULL,
    request_id                  IN VARCHAR2 DEFAULT NULL
)return CLOB;

Parameters

Parameter Type Value Range Required Default Description Notes
name VARCHAR2 Valid table identifier Yes No default Name of the vector table to create. The table must not already exist in the caller schema.
comment VARCHAR2 String or NULL No NULL Optional table comment. Returned as comment in table metadata.
annotations JSON Object or NULL No NULL User annotations stored with table metadata. Must be valid JSON.
table_params JSON Object or NULL No NULL Table creation options. Currently supports auto_generate_id.
embed_params JSON Object or NULL No NULL Embedding model configuration for integrated embedding tables. Supply when the table should generate vectors from metadata text by using a loaded embedding model. Omit for bring-your-own-vector tables.
index_params JSON Object or NULL No NULL Vector and metadata index configuration. Defaults are applied when omitted.
debug_flags JSON Object or NULL No NULL Debug/tracing flags. Optional.
request_id VARCHAR2 1-256 effective chars No NULL Correlation ID. Optional.

Example

declare
  out clob;
begin
  out := dbms_vector_database.create_vector_table(
    name => 'product_vectors',
    comment => 'Product catalog embeddings',
    table_params => JSON('{"auto_generate_id": false}'),
    annotations => JSON('{"domain": "retail"}'),
    index_params => JSON('{
      "vector_index_params": {
        "auto_index": true,
        "organization": "PARTITIONS",
        "distance_metric": "COSINE",
        "accuracy": 90
      },
      "metadata_index_params": {
        "auto_index": true,
        "include_paths": ["category", "price"]
      },
      "parallel_creation": 2
    }')
);
  dbms_vector_database.pretty_print(out);
end;
/

Example response

{
  "table_name": "PRODUCT_VECTORS",
  "comment": "Product catalog embeddings",
  "table_params": {
    "auto_generate_id": false
  },
  "annotations": {
    "domain": "retail"
  },
  "vector_type": "dense",
  "vector_table_type": "BYOV",
  "embed_params": null,
  "index_params": {
    "vector_index_params": {
      "auto_index": true,
      "organization": "PARTITIONS",
      "distance_metric": "COSINE",
      "accuracy": 90
    },
    "metadata_index_params": {
      "auto_index": true,
      "include_paths": ["category", "price"]
    },
    "parallel_creation": 2
  },
  "owner": "APPUSER",
  "indexes": [],
  "status": "Empty",
  "stats": {
    "total_vectors": 0
  },
  "created": "2026-05-01T10:00:00.000000+00:00",
  "updated": "2026-05-01T10:00:00.000000+00:00"
}

LIST_VECTOR_TABLES

Use the DBMS_VECTOR_DATABASE.LIST_VECTOR_TABLES PL/SQL function to list vector tables available in the caller schema.

Purpose

Use this function to retrieve public metadata for vector tables created by DBMS_VECTOR_DATABASE APIs. The function is read-only and returns an empty vector_tables array when no vector tables exist.

Syntax

DBMS_VECTOR_DATABASE.LIST_VECTOR_TABLES (
    debug_flags                 IN JSON DEFAULT NULL,
    request_id                  IN VARCHAR2 DEFAULT NULL
)return CLOB;

Parameters

Parameter Type Value Range Required Default Description Notes
debug_flags JSON Object or NULL No NULL Debug/tracing flags. Optional.
request_id VARCHAR2 1-256 effective chars No NULL Correlation ID. Optional.

Example

declare
  out clob;
begin
  out := dbms_vector_database.list_vector_tables();
  dbms_vector_database.pretty_print(out);
end;
/

Example response

{
  "vector_tables": [
    {
      "table_name": "MYVECTORS",
      "comment": "Product embeddings",
      "table_params": {
        "auto_generate_id": false
      },
      "annotations": {
        "domain": "retail"
      },
      "vector_type": "dense",
      "vector_table_type": "BYOV",
      "embed_params": null,
      "index_params": {
        "vector_index_params": {
          "auto_index": true,
          "organization": "PARTITIONS",
          "distance_metric": "COSINE"
        },
        "metadata_index_params": {
          "auto_index": true
        },
        "parallel_creation": 1
      },
      "owner": "APPUSER",
      "indexes": [],
      "status": "Empty",
      "stats": {
        "total_vectors": 0
      },
      "created": "2026-05-01T10:00:00.000000+00:00",
      "updated": "2026-05-01T10:00:00.000000+00:00"
    }
  ]
}

DESCRIBE_VECTOR_TABLE

Use the DBMS_VECTOR_DATABASE.DESCRIBE_VECTOR_TABLE PL/SQL function to retrieve metadata for a vector table.

Purpose

Use this function to inspect the public metadata for a vector table, including table creation parameters, embedding configuration, index configuration, status, statistics, and timestamps.

Syntax

DBMS_VECTOR_DATABASE.DESCRIBE_VECTOR_TABLE (
    name                        IN VARCHAR2,
    debug_flags                 IN JSON DEFAULT NULL,
    request_id                  IN VARCHAR2 DEFAULT NULL
)return CLOB;

Parameters

Parameter Type Value Range Required Default Description Notes
name VARCHAR2 Existing vector table Yes No default Vector table to describe. Must exist in caller schema.
debug_flags JSON Object or NULL No NULL Debug/tracing flags. Optional.
request_id VARCHAR2 1-256 effective chars No NULL Correlation ID. Optional.

Example

declare
  out clob;
begin
  out := dbms_vector_database.describe_vector_table('product_vectors');
  dbms_vector_database.pretty_print(out);
end;
/

Example response

{
  "table_name": "PRODUCT_VECTORS",
  "comment": "Product catalog embeddings",
  "table_params": {
    "auto_generate_id": false
  },
  "annotations": {
    "domain": "retail"
  },
  "vector_type": "dense",
  "vector_table_type": "BYOV",
  "embed_params": null,
  "index_params": {
    "vector_index_params": {
      "auto_index": true,
      "organization": "PARTITIONS",
      "distance_metric": "COSINE"
    },
    "metadata_index_params": {
      "auto_index": true
    },
    "parallel_creation": 1
  },
  "owner": "APPUSER",
  "indexes": [],
  "status": "Empty",
  "stats": {
    "total_vectors": 0
  },
  "created": "2026-05-01T10:00:00.000000+00:00",
  "updated": "2026-05-01T10:00:00.000000+00:00"
}

UPDATE_VECTOR_TABLE_ANNOTATION

Use the DBMS_VECTOR_DATABASE.UPDATE_VECTOR_TABLE_ANNOTATION PL/SQL function to update the public comment and annotations for a vector table.

Purpose

Use this function to update user-managed metadata for an existing vector table.

Impacts

Replaces the vector table’s comment and complete annotations JSON; annotations are not merged, so callers must provide the entire desired document. Commits automatically.

Syntax

DBMS_VECTOR_DATABASE.UPDATE_VECTOR_TABLE_ANNOTATION (
    name                        IN VARCHAR2,
    comment                     IN VARCHAR2 DEFAULT NULL,
    annotations                 IN JSON DEFAULT NULL,
    debug_flags                 IN JSON DEFAULT NULL,
    request_id                  IN VARCHAR2 DEFAULT NULL
)return CLOB;

Parameters

Parameter Type Value Range Required Default Description Notes
name VARCHAR2 Existing vector table Yes No default Vector table to update. Must exist in caller schema.
comment VARCHAR2 String or NULL No NULL Replacement table comment. Returned as comment in table metadata.
annotations JSON Object or NULL No NULL Replacement annotations. Must be valid JSON.
debug_flags JSON Object or NULL No NULL Debug/tracing flags. Optional.
request_id VARCHAR2 1-256 effective chars No NULL Correlation ID. Optional.

Example

declare
  out clob;
begin
  out := dbms_vector_database.update_vector_table_annotation(
    name => 'product_vectors',
    comment => 'Updated product embeddings',
    annotations => JSON('{"domain": "retail", "owner": "search"}')
);
  dbms_vector_database.pretty_print(out);
end;
/

Example response

{
  "table_name": "PRODUCT_VECTORS",
  "comment": "Updated product embeddings",
  "table_params": {
    "auto_generate_id": false
  },
  "annotations": {
    "domain": "retail",
    "owner": "search"
  },
  "vector_type": "dense",
  "vector_table_type": "BYOV",
  "embed_params": null,
  "index_params": {
    "vector_index_params": {
      "auto_index": true
    },
    "metadata_index_params": {
      "auto_index": true
    },
    "parallel_creation": 1
  },
  "owner": "APPUSER",
  "indexes": [],
  "status": "Empty",
  "stats": {
    "total_vectors": 0
  },
  "created": "2026-05-01T10:00:00.000000+00:00",
  "updated": "2026-05-02T09:30:00.000000+00:00"
}

DROP_VECTOR_TABLE

Use the DBMS_VECTOR_DATABASE.DROP_VECTOR_TABLE PL/SQL function to drop a vector table.

Purpose

Use this function to delete a vector table and its associated metadata and indexes. This is a destructive operation.

Warning: Do not use the SQL DROP TABLE statement to delete vector tables created with DBMS_VECTOR_DATABASE.CREATE_VECTOR_TABLE(). This can leave residual metadata entries with table_name: null that cannot be removed later. Use DBMS_VECTOR_DATABASE.DROP_VECTOR_TABLE() to remove the table and its associated metadata.

Syntax

DBMS_VECTOR_DATABASE.DROP_VECTOR_TABLE (
    name                        IN VARCHAR2,
    debug_flags                 IN JSON DEFAULT NULL,
    request_id                  IN VARCHAR2 DEFAULT NULL
)return CLOB;

Parameters

Parameter Type Value Range Required Default Description Notes
name VARCHAR2 Existing vector table Yes No default Vector table to drop. Must exist in caller schema.
debug_flags JSON Object or NULL No NULL Debug/tracing flags. Optional.
request_id VARCHAR2 1-256 effective chars No NULL Correlation ID. Optional.

Example

declare
  out clob;
begin
  out := dbms_vector_database.drop_vector_table('product_vectors');
  dbms_vector_database.pretty_print(out);
end;
/

Example response

{
  "message": "Table PRODUCT_VECTORS deleted successfully"
}

Manage Data

These functions enable you to generate embeddings, manage vector data, and load vectors.

Subprograms in this section: DBMS_VECTOR_DATABASE.GENERATE_EMBEDDING(), DBMS_VECTOR_DATABASE.LIST_VECTORS(), DBMS_VECTOR_DATABASE.LOAD_VECTORS(), DBMS_VECTOR_DATABASE.UPSERT_VECTORS(), DBMS_VECTOR_DATABASE.DELETE_VECTORS().

GENERATE_EMBEDDING

Use the DBMS_VECTOR_DATABASE.GENERATE_EMBEDDING PL/SQL function to generate vector embeddings from text.

Purpose

Use this function to generate embeddings for a JSON array of input text objects using a database embedding model.

Syntax

DBMS_VECTOR_DATABASE.GENERATE_EMBEDDING (
    model_name                  IN VARCHAR2,
    inputs                      IN SYS.JSON_ARRAY_T,
    debug_flags                 IN JSON DEFAULT NULL,
    request_id                  IN VARCHAR2 DEFAULT NULL
)return CLOB;

Parameters

Parameter Type Value Range Required Default Description Notes
model_name VARCHAR2 Existing model Yes No default Embedding model name. Must exist in caller schema.
inputs SYS.JSON_ARRAY_T Array of objects Yes No default Input text objects. Each object must include text.
debug_flags JSON Object or NULL No NULL Debug/tracing flags. Optional.
request_id VARCHAR2 1-256 effective chars No NULL Correlation ID. Optional.

Example

declare
  out clob;
begin
  out := dbms_vector_database.generate_embedding(
    model_name => 'DOC_EMBED_MODEL',
    inputs => SYS.JSON_ARRAY_T('[{"text": "hello world"}]')
);
  dbms_vector_database.pretty_print(out);
end;
/

Example response

{
  "data": [
    {
      "text": "hello world",
      "embedding": [
        0.0117027815,
        0.00419755466,
        -0.0301191173,
        0.011317092
      ]
    }
  ]
}

LIST_VECTORS

Use the DBMS_VECTOR_DATABASE.LIST_VECTORS PL/SQL function to list existing vector records by ID or with pagination.

Purpose

Use this function to list complete vector records, including their IDs, dense vectors, and metadata, from a specified table.

Syntax

DBMS_VECTOR_DATABASE.LIST_VECTORS (
    table_name                  IN VARCHAR2,
    ids                         IN JSON DEFAULT NULL,
    limit                       IN NUMBER DEFAULT 15,
    offset                      IN NUMBER DEFAULT NULL,
    debug_flags                 IN JSON DEFAULT NULL,
    request_id                  IN VARCHAR2 DEFAULT NULL
)return CLOB;

Parameters

Parameter Type Value Range Required Default Description Notes
table_name VARCHAR2 Existing vector table Yes No default Table to read. Must exist in caller schema.
ids JSON Array of strings No NULL Optional list of vector IDs to retrieve. Example: ["id1", "id2", "id3"]. Builds an ID filter when provided.
limit NUMBER > 0 No 15 Max rows returned. Defaults to 15.
offset NUMBER >= 0 or NULL No 0 Rows to skip. Null is returned as 0.
debug_flags JSON Object or NULL No NULL Debug/tracing flags. Optional.
request_id VARCHAR2 1-256 effective chars No NULL Correlation ID. Optional.

Get specific vectors by ID

declare
  out clob;
begin
  out := dbms_vector_database.list_vectors(
    table_name => 'sample_table',
    ids => JSON('["id1", "id2"]')
);
  dbms_vector_database.pretty_print(out);
end;
/

Paginate through results (first 10 results)

declare
  out clob;
begin
  out := dbms_vector_database.list_vectors(
    table_name => 'sample_table',
    limit => 10,
    offset => 0
);
  dbms_vector_database.pretty_print(out);
end;
/

Next 10 results

declare
  out clob;
begin
  out := dbms_vector_database.list_vectors(
    table_name => 'sample_table',
    limit => 10,
    offset => 10
);
  dbms_vector_database.pretty_print(out);
end;
/

Example response

{
  "items": [
    {
      "id": "id1",
      "dense_vector": [0.1, 0.5, 0.4, 0.56],
      "metadata": {
        "product_name": "Noise Cancelling Headphones",
        "category": "electronics",
        "brand": "Sony",
        "price": 299.99
      }
    },
    {
      "id": "id2",
      "dense_vector": [0.14, 0.534, 0.12, 0.58],
      "metadata": {
        "product_name": "Studio Monitor Headphones",
        "category": "electronics",
        "brand": "Audio-Technica",
        "price": 149.99
      }
    }
  ],
  "limit": 2,
  "offset": 0,
  "count": 2
}

LOAD_VECTORS

Use the DBMS_VECTOR_DATABASE.LOAD_VECTORS PL/SQL function to load vector data from a CSV file in cloud storage into an existing vector table.

Purpose

Use this function to append vector records from cloud storage into an existing vector table. The table must already exist. For integrated embedding tables, the table’s embed_params configuration is used to generate embeddings when needed.

Impacts

This function runs synchronously and can take time to complete, depending on the amount of data to load.

Performance consideration: When source records do not contain precomputed vectors, embedding is performed as part of the load job using database CPU resources. This can make integrated embedding loads slower than loading precomputed vectors and can increase database CPU utilization during the job.

Syntax

DBMS_VECTOR_DATABASE.LOAD_VECTORS (
    table_name                  IN VARCHAR2,
    url                         IN VARCHAR2,
    params                      IN JSON DEFAULT NULL,
    debug_flags                 IN JSON DEFAULT NULL,
    request_id                  IN VARCHAR2 DEFAULT NULL
)return CLOB;

Parameters

Parameter Type Value Range Required Default Description Notes
table_name VARCHAR2 Existing vector table Yes No default Target table. Must exist in caller schema.
url VARCHAR2 Cloud URI Yes No default CSV file URI. The database must be able to access the file.
params JSON Object or NULL No NULL Optional load settings. Supports credential.
debug_flags JSON Object or NULL No NULL Debug/tracing flags. Optional.
request_id VARCHAR2 1-256 effective chars No NULL Correlation ID. Optional.

params fields

Field Type Value Range Required Description Notes
credential VARCHAR2 Valid credential name No Database credential used when the object storage URL requires authentication. Refer to the Oracle Cloud Infrastructure documentation for configuring object storage credentials: Managing Credentials. Required only for private or protected object storage URLs.

Guidelines for Preparing CSV Files for LOAD_VECTORS Function

General Structure

Handling Fields with Commas

Embedding JSON in CSV

If the following guidelines are not followed, the CSV parser may incorrectly split fields, resulting in ingestion errors.

JSON example:

id,metadata
77E0D7F0-1942-494A-ACE2-9004D2BDC59E,"{""PARK_CODE"":""abli"",""NAME"":""Abraham Lincoln Birthplace"",""STATES"":""KY""}"

Header Row Formats

For integrated embedding vector tables, use one of the following header row formats:

For bring-your-own-vector tables, use one of the following header row formats:

The order of columns is flexible. Headers are not case-sensitive.

ID Field Guidelines

For integrated embedding tables, metadata must include the text path configured by embed_params.embed_metadata_jsonpath. For example, if embed_metadata_jsonpath is description, then each metadata object must contain a description text value. Use a JSON path, such as details.summary, to embed text from nested metadata.

Example

declare
  out clob;
begin
  out := dbms_vector_database.load_vectors(
    table_name => 'product_vectors',
    url => 'https://objectstorage.example.com/data/product_vectors.csv',
    params => JSON('{"credential": "OBJ_STORE_CRED"}')
);
  dbms_vector_database.pretty_print(out);
end;
/

Example response

{
  "table_name": "PRODUCT_VECTORS",
  "file_url": "https://objectstorage.example.com/data/product_vectors.csv"
}

UPSERT_VECTORS

Use the DBMS_VECTOR_DATABASE.UPSERT_VECTORS PL/SQL function to insert or update vectors in a specified table.

Purpose

Use this function to ingest new vectors, add metadata, or update existing vectors.

Syntax

DBMS_VECTOR_DATABASE.UPSERT_VECTORS (
    table_name                  IN VARCHAR2,
    vectors                     IN JSON,
    debug_flags                 IN JSON DEFAULT NULL,
    request_id                  IN VARCHAR2 DEFAULT NULL
)return CLOB;

Parameters

Parameter Type Value Range Required Default Description Notes
table_name VARCHAR2 Existing vector table Yes No default Target table. Must exist in caller schema.
vectors JSON Array of vector record objects Yes No default Rows to insert/update. For bring-your-own-vector tables, include precomputed dense_vector values. For integrated embedding tables, include text in metadata at the configured embedding source field. Each ID must not exceed 40 characters.
debug_flags JSON Object or NULL No NULL Debug/tracing flags. Optional.
request_id VARCHAR2 1-256 effective chars No NULL Correlation ID. Optional.

Example

declare
  out clob;
begin
  out := dbms_vector_database.upsert_vectors(
    'sample_table',
    vectors => JSON('[
      {
        "id": "vec1",
        "dense_vector": [0.1, 0.5, 0.4, 0.56],
        "metadata": {"type": "document", "source": "Wikipedia"}
      },
      {
        "id": "vec2",
        "dense_vector": [0.14, 0.534, 0.12, 0.58],
        "metadata": {"type": "document", "source": "Internal"}
      }
    ]')
);
  dbms_vector_database.pretty_print(out);
end;
/

Example response

{
  "upserted_count": 2
}

DELETE_VECTORS

Use the DBMS_VECTOR_DATABASE.DELETE_VECTORS PL/SQL function to delete existing vectors by ID from a specified table.

Purpose

Use this function to remove unwanted vectors from a specified table.

Impacts

Permanently deletes the specified vector records, refreshes related statistics, and commits the changes automatically; the deletion cannot be rolled back as part of the current transaction.

Syntax

DBMS_VECTOR_DATABASE.DELETE_VECTORS (
    table_name                  IN VARCHAR2,
    ids                         IN JSON,
    debug_flags                 IN JSON DEFAULT NULL,
    request_id                  IN VARCHAR2 DEFAULT NULL
)return CLOB;

Parameters

Parameter Type Value Range Required Default Description Notes
table_name VARCHAR2 Existing vector table Yes No default Target table. Must exist in caller schema.
ids JSON Array of strings Yes No default IDs to delete. Use explicit ID arrays.
debug_flags JSON Object or NULL No NULL Debug/tracing flags. Optional.
request_id VARCHAR2 1-256 effective chars No NULL Correlation ID. Optional.

Example

declare
  out clob;
begin
  out := dbms_vector_database.delete_vectors('myvectors', JSON('["vec1", "vec2"]'));
  dbms_vector_database.pretty_print(out);
end;
/

Example response

{
  "message": "Deleted 2 rows successfully"
}

Search Data

These functions enable you to perform similarity search and rerank search results.

Subprograms in this section: DBMS_VECTOR_DATABASE.SEARCH(), DBMS_VECTOR_DATABASE.RERANK().

SEARCH

Use the DBMS_VECTOR_DATABASE.SEARCH PL/SQL function to search a vector table using a query vector, text, or record ID.

Purpose

Use this function to perform similarity search and find the most similar vectors in a table. It supports metadata filters and distance metrics. It returns IDs, metadata, vectors, and distance values/scores. For common distance metrics, lower values indicate closer matches. Text search requires an integrated embedding table with embed_params.

Use query_by to search with text, a vector, or an ID. Exactly one query mode must be supplied.

Notes:

Syntax

DBMS_VECTOR_DATABASE.SEARCH (
    table_name                  IN VARCHAR2,
    query_by                    IN JSON,
    filters                     IN JSON DEFAULT NULL,
    top_k                       IN NUMBER,
    include_vectors             IN BOOLEAN DEFAULT FALSE,
    output_selector             IN JSON DEFAULT NULL,
    advanced_options            IN JSON DEFAULT NULL,
    debug_flags                 IN JSON DEFAULT NULL,
    request_id                  IN VARCHAR2 DEFAULT NULL
)return CLOB;

Parameters

Parameter Type Value Range Required Default Description Notes
table_name VARCHAR2 Existing vector table Yes No default Table to search. Must exist in caller schema.
query_by JSON Exactly one query mode Yes No default Query vector source. text, id, or vector.
filters JSON Object or NULL No NULL Metadata filters. Must be a JSON object when provided; translated by the QBE helper and applied to metadata.
top_k NUMBER > 0 Yes No default Number of results requested. Zero or negative values raise a validation error.
include_vectors BOOLEAN TRUE, FALSE No FALSE Include result vectors in output. Defaults to FALSE.
output_selector JSON Array of strings or NULL No NULL Top-level metadata keys to project in each result. NULL returns full metadata; an empty array returns an empty metadata object.
advanced_options JSON Object or NULL No NULL Search tuning options. Supports distance_metric, accuracy, and idx_parameters.
debug_flags JSON Object or NULL No NULL Debug/tracing flags. Optional.
request_id VARCHAR2 1-256 effective chars No NULL Correlation ID. Optional.

output_selector values

Value Result Notes
NULL Returns full CONTENT_METADATA. Default result.
Array of strings Projects selected top-level metadata keys into the result metadata object. Example: ['tenant', 'title'].
Empty array Returns an empty metadata object. Results still include id and distance.
Dotted string Treats the value as a literal top-level key. ['a.b'] is treated as a literal key, not a nested JSON path.
Non-string or empty-string entry Not supported. Use arrays of non-empty strings only.

query_by

Exactly one query mode must be supplied.

Field Type Required Description Notes
text string One of three Text query embedded with the table model. Only valid for integrated embedding tables.
id scalar One of three Uses the stored vector for the ID. Null or non-scalar values raise validation errors.
vector array of number One of three Caller-supplied query vector. Used directly.

filters

Search uses QBE translation for filters. The SEARCH signature does not change, but filter validation is handled through the QBE translator.

Capability Operator / syntax Example
Direct equality field: value {"status":"active"}
Existence $exists {"email":{"$exists":true}}
Equality $eq {"tier":{"$eq":"gold"}}
Inequality $ne {"tier":{"$ne":"bronze"}}
Greater than $gt {"age":{"$gt":40}}
Greater than or equal $gte {"age":{"$gte":41}}
Less than $lt {"age":{"$lt":40}}
Less than or equal $lte {"age":{"$lte":30}}
Inclusive range $between {"age":{"$between":[30,41]}}
Value in a list $in {"tier":{"$in":["gold","silver"]}}
Value not in a list $nin {"tier":{"$nin":["bronze"]}}
Array contains all values $all {"tags":{"$all":["oracle","security"]}}
String prefix $startsWith {"name":{"$startsWith":"Ada"}}
String substring $hasSubstring {"description":{"$hasSubstring":"Oracle"}}
String substring alias $instr {"description":{"$instr":"security"}}
Regular expression $regex {"name":{"$regex":"^Ada.*"}}
SQL LIKE pattern $like {"name":{"$like":"Ada%"}}
Logical AND $and {"$and":[{"status":"active"},{"balance":{"$gt":10000}}]}
Logical OR $or {"$or":[{"tier":"silver"},{"balance":{"$gt":10000}}]}
Logical NOR $nor {"$nor":[{"tier":"gold"},{"tier":"silver"}]}
Negation $not {"status":{"$not":{"$eq":"inactive"}}}
Same array-object match parent[*]: {...} {"addresses[*]":{"city":"Boston","state":"MA"}}
Absolute value $abs {"temperature":{"$abs":{"$gt":40}}}
Round up $ceiling {"temperature":{"$ceiling":{"$lt":20}}}
Round down $floor {"temperature":{"$floor":{"$lte":0}}}
Convert to number $number {"age":{"$number":{"$gt":40}}}
Convert to binary double $double {"price":{"$double":{"$gt":25}}}
Convert to lowercase $lower {"name":{"$lower":"ada lovelace"}}
Convert to uppercase $upper {"name":{"$upper":"GRACE HOPPER"}}
String length $length {"name":{"$length":{"$gt":10}}}
Convert to string $string {"age":{"$string":{"$eq":"30"}}}
Boolean conversion $boolean {"isPreferred":{"$boolean":true}}
JSON data type $type {"location":{"$type":"object"}}
Array/object size $size {"items":{"$size":{"$gte":3}}}
Date conversion $date {"birthDate":{"$date":{"$gte":"2000-01-01"}}}
Timestamp conversion $timestamp {"createdAt":{"$timestamp":{"$lt":"2026-01-01T00:00:00Z"}}}
Spatial proximity $near {"location":{"$near":{"$geometry":{"type":"Point","coordinates":[-122.417,37.783]},"$distance":10,"$unit":"mile"}}}
Spatial intersection $intersects {"location":{"$intersects":{"$geometry":{"type":"Point","coordinates":[-122.417,37.783]}}}}
Spatial containment $within {"location":{"$within":{"$geometry":{"type":"Polygon","coordinates":[[[-123,37],[-122,37],[-122,38],[-123,38],[-123,37]]]}}}}

For more information about the filter syntax, see SODA Filter Specifications.

advanced_options

Field Type Required Description Notes
distance_metric string No Query-time distance metric. Validation is case-insensitive. For more information, see Vector Distance Metrics.
accuracy number No Query-time trade-off between speed and accuracy. Use a higher value when search quality is more important than speed. For more information, see Understand Approximate Similarity Search Using Vector Indexes.
idx_parameters object No Query-time vector index parameters. Use efsearch only with HNSW indexes and neighbor partition probes only with IVF indexes.

idx_parameters fields

Field Type Value Range Required Description Notes
efsearch integer > 0 No HNSW beam width that controls recall. Use this value to specify the maximum number of candidates considered while probing the index. Supported only with HNSW.
neighbor partition probes integer > 0 No IVF partition probes. Increasing the number of partitions scanned can improve recall for IVF indexes. Supported only with IVF.
rescore_factor integer 1-100 No Controls the number of candidates rescored during search. Use only when quantization is configured when creating the vector table.

Example

declare
  out clob;
begin
  out := dbms_vector_database.search(
    table_name => 'product_vectors',
    query_by => JSON('{"text": "good headphone"}'),
    top_k => 5,
    filters => JSON('{
      "$and": [
        {"category": {"$eq": "electronics"}},
        {"price": {"$lt": 200}}
      ]
    }'),
    output_selector => JSON('["product_name", "price", "product_description"]'),
    include_vectors => FALSE
);
  dbms_vector_database.pretty_print(out);
end;
/

Example response

{
  "results": [
    {
      "id": "id2",
      "distance": 0.212,
      "metadata": {
        "product_name": "Studio Monitor Headphones",
        "price": 149.99,
        "product_description": "Professional wired headphones with accurate sound for studio use."
      }
    },
    {
      "id": "id5",
      "distance": 0.678,
      "metadata": {
        "product_name": "Wireless Earbuds",
        "price": 199.99,
        "product_description": "Noise-cancelling wireless earbuds with rich sound and secure fit."
      }
    }
  ]
}

When include_vectors is TRUE, each result can also include a vector field.

RERANK

Use the DBMS_VECTOR_DATABASE.RERANK PL/SQL function to rerank documents against a query.

Purpose

Use this function to rerank candidate documents by relevance to a query using a database rerank model. The function returns the response from DBMS_VECTOR.RERANK.

Syntax

DBMS_VECTOR_DATABASE.RERANK (
    model_name                  IN VARCHAR2,
    query                       IN VARCHAR2,
    documents                   IN JSON,
    model_params                IN JSON DEFAULT NULL,
    debug_flags                 IN JSON DEFAULT NULL,
    request_id                  IN VARCHAR2 DEFAULT NULL
)return CLOB;

Parameters

Parameter Type Value Range Required Default Description Notes
model_name VARCHAR2 Existing model Yes No default Rerank model name. Must exist in caller schema.
query VARCHAR2 Non-empty string Yes No default Query used for reranking. Empty values raise validation error.
documents JSON Array Yes No default Candidate documents to rerank. Must be a JSON array.
model_params JSON Object or NULL No NULL Rerank options. Supports top_n.
debug_flags JSON Object or NULL No NULL Debug/tracing flags. Optional.
request_id VARCHAR2 1-256 effective chars No NULL Correlation ID. Optional.

Example

declare
  out clob;
begin
  out := dbms_vector_database.rerank(
    model_name => 'RERANK_MODEL',
    query => 'good headphone',
    documents => JSON('[
      "Studio Monitor Headphones",
      "Wireless Earbuds",
      "Coffee Grinder"
    ]'),
    model_params => JSON('{"top_n": 2}')
);
  dbms_vector_database.pretty_print(out);
end;
/

Example response

[
  {
    "index": 0,
    "score": 0.92
  },
  {
    "index": 1,
    "score": 0.76
  }
]

Indexes

These functions enable you to create, check, rebuild, and drop vector indexes.

Subprograms in this section: DBMS_VECTOR_DATABASE.CREATE_INDEX(), DBMS_VECTOR_DATABASE.INDEX_BUILD_STATUS(), DBMS_VECTOR_DATABASE.REBUILD_INDEX(), DBMS_VECTOR_DATABASE.DROP_INDEX().

CREATE_INDEX

Use the DBMS_VECTOR_DATABASE.CREATE_INDEX PL/SQL function to create or update vector and metadata indexes for a vector table.

Purpose

Use this function to create vector indexes, metadata indexes, or both for an existing vector table. Pass nested index_params to control vector index settings and metadata path indexing.

Impacts

This function runs synchronously and can take time to complete, depending on the table size and index configuration.

Syntax

DBMS_VECTOR_DATABASE.CREATE_INDEX (
    table_name                  IN VARCHAR2,
    index_params                IN JSON DEFAULT NULL,
    debug_flags                 IN JSON DEFAULT NULL,
    request_id                  IN VARCHAR2 DEFAULT NULL
)return CLOB;

Parameters

Parameter Type Value Range Required Default Description Notes
table_name VARCHAR2 Existing vector table Yes No default Table to index. Must exist in caller schema.
index_params JSON Object or NULL No NULL Vector and metadata index configuration. Defaults are applied when omitted.
debug_flags JSON Object or NULL No NULL Debug/tracing flags. Optional.
request_id VARCHAR2 1-256 effective chars No NULL Correlation ID. Optional.

Example

declare
  out clob;
begin
  out := dbms_vector_database.create_index(
    table_name => 'product_vectors',
    index_params => JSON('{
      "vector_index_params": {
        "auto_index": true,
        "organization": "INMEMORY GRAPH",
        "distance_metric": "COSINE",
        "accuracy": 95,
        "quantization_type": "SCALAR",
        "compression_ratio": 4,
        "advanced_params": {
          "neighbors": 32,
          "efConstruction": 128,
          "rescore_factor": 4,
          "algorithm": "uniform_quantization"
        }
      },
      "metadata_index_params": {
        "auto_index": true,
        "include_paths": ["category", "price"]
      },
      "parallel_creation": 2
    }')
);
  dbms_vector_database.pretty_print(out);
end;
/

Example response

{
  "message": "Vector index VECIDX_PRODUCT_VECTORS_20260501T100000 and Metadata index(es) for paths [category, price] created successfully for table PRODUCT_VECTORS"
}

INDEX_BUILD_STATUS

Use the DBMS_VECTOR_DATABASE.INDEX_BUILD_STATUS PL/SQL function to retrieve vector index build status for a vector table.

Purpose

Use this function to monitor the build or rebuild status of the vector index associated with a vector table.

Syntax

DBMS_VECTOR_DATABASE.INDEX_BUILD_STATUS (
    table_name                  IN VARCHAR2,
    debug_flags                 IN JSON DEFAULT NULL,
    request_id                  IN VARCHAR2 DEFAULT NULL
)return CLOB;

Parameters

Parameter Type Value Range Required Default Description Notes
table_name VARCHAR2 Existing vector table Yes No default Table whose vector index status is checked. Must exist in caller schema.
debug_flags JSON Object or NULL No NULL Debug/tracing flags. Optional.
request_id VARCHAR2 1-256 effective chars No NULL Correlation ID. Optional.

Example

declare
  out clob;
begin
  out := dbms_vector_database.index_build_status('product_vectors');
  dbms_vector_database.pretty_print(out);
end;
/

Example response

{
  "Index Status": "Index build in progress...\nCurrent progress: 75%"
}

REBUILD_INDEX

Use the DBMS_VECTOR_DATABASE.REBUILD_INDEX PL/SQL function to rebuild vector and metadata indexes for a vector table.

Purpose

Use this function to rebuild vector indexes, metadata indexes, or both. Pass nested index_params to select and tune the rebuild.

Impacts

This function runs synchronously and can take time to complete, depending on the table size and index configuration.

Syntax

DBMS_VECTOR_DATABASE.REBUILD_INDEX (
    table_name                  IN VARCHAR2,
    index_params                IN JSON DEFAULT NULL,
    debug_flags                 IN JSON DEFAULT NULL,
    request_id                  IN VARCHAR2 DEFAULT NULL
)return CLOB;

Parameters

Parameter Type Value Range Required Default Description Notes
table_name VARCHAR2 Existing vector table Yes No default Table whose indexes are rebuilt. Must exist in caller schema.
index_params JSON Object or NULL No NULL Rebuild scope and index configuration. metadata_index_params.auto_index is not supported for rebuild.
debug_flags JSON Object or NULL No NULL Debug/tracing flags. Optional.
request_id VARCHAR2 1-256 effective chars No NULL Correlation ID. Optional.

Example

declare
  out clob;
begin
  out := dbms_vector_database.rebuild_index(
    table_name => 'product_vectors',
    index_params => JSON('{
      "vector_index_params": {
        "auto_index": true,
        "organization": "INMEMORY GRAPH",
        "distance_metric": "COSINE",
        "advanced_params": {
          "neighbors": 32,
          "efConstruction": 128,
          "rescore_factor": 4
        }
      },
      "parallel_creation": 2
    }')
);
  dbms_vector_database.pretty_print(out);
end;
/

Example response

{
  "message": "Vector index VECIDX_PRODUCT_VECTORS_20260501T100000 Rebuild successfully for table PRODUCT_VECTORS"
}

DROP_INDEX

Use the DBMS_VECTOR_DATABASE.DROP_INDEX PL/SQL function to drop vector and metadata indexes from a vector table.

Purpose

Use this function to drop the vector index, metadata indexes, or both. The optional index_params.index_type field controls the target scope.

Syntax

DBMS_VECTOR_DATABASE.DROP_INDEX (
    table_name                  IN VARCHAR2,
    debug_flags                 IN JSON DEFAULT NULL,
    request_id                  IN VARCHAR2 DEFAULT NULL,
    index_params                IN JSON DEFAULT NULL
)return CLOB;

Parameters

Parameter Type Value Range Required Default Description Notes
table_name VARCHAR2 Existing vector table Yes No default Table whose indexes are dropped. Must exist in caller schema.
debug_flags JSON Object or NULL No NULL Debug/tracing flags. Optional.
request_id VARCHAR2 1-256 effective chars No NULL Correlation ID. Optional.
index_params JSON Object or NULL No NULL Drop scope and metadata path selection. Supports index_type, metadata_index_params.include_paths, and metadata_index_params.exclude_paths.

index_params.index_type accepts vector, metadata, or all. vector_index_params is not supported for DROP_INDEX; use index_type to select vector index removal. metadata_index_params.auto_index is also not supported for DROP_INDEX.

Example

declare
  out clob;
begin
  out := dbms_vector_database.drop_index(
    table_name => 'product_vectors',
    index_params => JSON('{
      "index_type": "metadata",
      "metadata_index_params": {
        "include_paths": ["category", "price"]
      }
    }')
);
  dbms_vector_database.pretty_print(out);
end;
/

Example response

{
  "message": "MVI index(es) for paths [category, price] dropped successfully from table PRODUCT_VECTORS"
}

Shared Parameter Objects

Use these shared object definitions for PL/SQL JSON parameters that accept nested configuration objects.

table_params

table_params defines table creation options.

Field Type Value Range Required Default Description Notes
auto_generate_id boolean true, false No false Controls whether the database automatically generates IDs for inserted records. When set to true, the database automatically generates an ID for each vector that does not provide an explicit ID. You can still use upsert or load operations with explicit IDs.

embed_params

embed_params defines how the database generates embeddings automatically from metadata content.

Use embed_params when the table should store vectors generated from text in each row’s metadata JSON. Set model to a loaded embedding model. Set embed_metadata_jsonpath to the metadata field that contains the text to embed, such as description or details.summary.

To select metadata content for embedding, choose the field that contains the natural-language text. For metadata such as {"description":"Compact wireless headphones","details":{"summary":"Noise-canceling audio"}}, use description to embed the top-level description, or use details.summary to embed the nested summary. Other metadata fields remain available for filtering or indexing, but they are not used as embedding input by this setting.

Resource usage: Configuring embed_params causes embedding to occur inside Oracle AI Database whenever an operation supplies text that requires a vector. The embedding work uses database CPU resources and is performed inline with the operation. Consider workload volume and latency requirements when choosing between integrated embedding and precomputed vectors.

Field Type Value Range Required Description Notes
model string 1-128 chars Yes Name of the loaded embedding model to use for automatic embedding. Model must exist in the caller schema. Use a model name returned by LIST_MODELS; load one with LOAD_MODEL if needed.
embed_metadata_jsonpath string 1-128 chars Yes Metadata field or JSON path that selects the text value to embed. Use a simple field name, such as description, or a JSON path, such as details.summary. Each inserted or loaded row’s metadata must contain this path, and the selected value should be text.

index_params

index_params defines how vector and metadata indexes are created and managed.

Field Type Value Range Required Description Notes
index_type string vector, metadata, all No Index rebuild or drop scope. Use with REBUILD_INDEX or DROP_INDEX: vector selects the vector index, metadata selects metadata indexes, and all selects both. For rebuild, omit index_type to rebuild only the index indicated by the supplied nested parameters; set it to all to rebuild both indexes. Omit it for create operations.
vector_index_params object vector_index_params object No Controls how the vector index is built and managed. Contains vector index settings and advanced tuning parameters.
metadata_index_params object metadata_index_params object No Controls how metadata JSON paths are indexed and maintained. Supports automatic path discovery and explicit include/exclude overrides.
parallel_creation integer or null >= 1 No Controls index creation or rebuild parallelism. Uses parallel DDL for vector and metadata index creation when supported; defaults to 1 when normalized.

vector_index_params

vector_index_params controls vector index configuration. It defines how the vector index is built and managed, including vector index settings and advanced tuning parameters.

Field Type Value Range Required Description Notes
auto_index boolean true, false No Controls whether the vector index is created automatically or only when requested explicitly. Defaults to true when vector parameters are normalized. Set to false when you want to create or manage the vector index through explicit index lifecycle operations.
organization string PARTITIONS, INMEMORY GRAPH No Controls vector index organization. Defaults to PARTITIONS. PARTITIONS builds an IVF index, and INMEMORY GRAPH builds an HNSW index.
distance_metric string MANHATTAN, DOT, COSINE, EUCLIDEAN, EUCLIDEAN_SQUARED, L2_SQUARED No Distance or similarity metric used by the vector index. Defaults to COSINE when omitted. Validation is case-insensitive. For more information, see Vector Distance Metrics.
accuracy integer 0-100 No Controls target index accuracy. Optional tuning parameter. The implementation default is used when omitted. Use this value to adjust the trade-off between speed and accuracy. For more information, see Understand Approximate Similarity Search Using Vector Indexes.
quantization_type string or null NONE, SCALAR No Vector index quantization mode. Use SCALAR with compression_ratio to compress vectors. Omit or use NONE when scalar quantization is not needed. Quantization is supported only with HNSW indexes.
compression_ratio number or null 2, 4, 8 No Controls how much to compress vectors when scalar quantization is enabled. Populate when quantization_type is SCALAR. Valid values are 2, 4, and 8.
advanced_params object advanced_params object No Advanced vector index tuning parameters. Supported fields depend on organization. Use partitions with PARTITIONS; use graph parameters, such as neighbors and efConstruction, with INMEMORY GRAPH.

metadata_index_params

metadata_index_params creates indexes on metadata paths used in filters, helping reduce filtering cost and improve filtered-search performance.

Field Type Value Range Required Description Notes
auto_index boolean true, false No Controls whether metadata indexes are automatically created and maintained. Defaults to true in create flows. When true, the database automatically creates and maintains indexes on qualifying metadata paths, up to the supported limit. When false, only user-specified paths are indexed.
include_paths array of string JSON paths or * No Explicit list of metadata JSON paths to include in metadata indexing. Use explicit paths, such as year or details.genre, to force those paths into the metadata index selection. Use * to request all qualifying paths. Exact paths are normalized.
exclude_paths array of string JSON paths or * No Explicit list of metadata JSON paths to exclude from metadata indexing. Use explicit paths to override automatic selection or an include_paths wildcard. include_paths=["*"] with exclude_paths=["*"] is invalid.

Metadata indexing supports up to the first 50 qualifying paths when automatic path discovery is used. Qualifying paths are scalar metadata values that can be indexed. Arrays, objects, strings longer than 2 KB, and the path referenced by embed_metadata_jsonpath are not qualifying metadata index paths.

Use these common patterns:

{
  "metadata_index_params": {
    "auto_index": true
  }
}

Automatically discover and index qualifying metadata paths, up to the supported limit.

{
  "metadata_index_params": {
    "auto_index": false,
    "include_paths": ["year", "genre"]
  }
}

Index only the selected metadata paths.

{
  "metadata_index_params": {
    "include_paths": ["*"],
    "exclude_paths": ["title"]
  }
}

Request all qualifying metadata paths except the excluded paths.

advanced_params

advanced_params controls vector index tuning.

Field Type Value Range Required Description Notes
partitions integer 1-10000000 No IVF or partition count. Applies to PARTITIONS.
neighbors integer 1-2048 No HNSW graph neighbor count. Applies to INMEMORY GRAPH.
efConstruction integer 1-65535 No HNSW construction beam width. Applies to INMEMORY GRAPH.
rescore_factor integer 1-100 No Rescore factor for HNSW index tuning. Use only with scalar quantization.
algorithm string uniform_quantization No HNSW quantization algorithm. Used with scalar quantization settings.