1️⃣ Create a Vector-Enabled Table (Oracle 23ai)
Oracle 23ai introduces the native VECTOR data type.
CREATE TABLE erp_vector_store (
doc_id NUMBER GENERATED BY DEFAULT AS IDENTITY,
source_type VARCHAR2(30), -- SOP, PO, FAQ
module VARCHAR2(30), -- PROCUREMENT, AP
doc_text CLOB,
embedding VECTOR(1536)
);
✔ Vectors live inside Oracle Database
✔ Same security, same backup, same governance as ERP data
2️⃣ Insert ERP Content with Vector Embeddings
Example ERP content:
"Buyers can cancel a purchase order after approval by initiating a change order."
Insert with embedding (generated externally via AI Studio / OCI GenAI):
INSERT INTO erp_vector_store (
source_type,
module,
doc_text,
embedding
)
VALUES (
'SOP',
'PROCUREMENT',
'Buyers can cancel a purchase order after approval by initiating a change order.',
VECTOR('[0.021, -0.334, 0.119, ...]')
);
In real implementations, embeddings are passed from AI Studio or OCI Generative AI APIs.
3️⃣ Create a Vector Index (ANN – Approximate Nearest Neighbor)
Oracle 23ai supports HNSW-based vector indexing.
CREATE VECTOR INDEX erp_vec_idx
ON erp_vector_store (embedding)
ORGANIZATION INMEMORY
WITH TARGET ACCURACY 95;
This enables millisecond-level semantic search, even at scale.
4️⃣ Semantic Search Using VECTOR_DISTANCE (Oracle 23ai)
User question:
“How do I cancel an approved PO?”
Query using COSINE similarity:
SELECT
doc_id,
source_type,
module,
doc_text,
VECTOR_DISTANCE(
embedding,
:query_embedding,
COSINE
) AS similarity_score
FROM erp_vector_store
ORDER BY similarity_score
FETCH FIRST 3 ROWS ONLY;
✅ Returns the most semantically relevant ERP content
❌ No keywords
❌ No LIKE conditions
5️⃣ Filtered Vector Search (ERP-Realistic)
Search only Procurement SOPs:
SELECT doc_text
FROM erp_vector_store
WHERE module = 'PROCUREMENT'
ORDER BY VECTOR_DISTANCE(
embedding,
:query_embedding,
COSINE
)
FETCH FIRST 2 ROWS ONLY;
This is powerful for:
BU-specific answers
Module-specific assistants
Role-based ERP intelligence
6️⃣ Hybrid Search (Vector + Business Filters)
Example: Procurement + SOPs only
SELECT doc_text
FROM erp_vector_store
WHERE source_type = 'SOP'
AND module = 'PROCUREMENT'
ORDER BY VECTOR_DISTANCE(
embedding,
:query_embedding,
COSINE
)
FETCH FIRST 1 ROW ONLY;
✔ Semantic relevance
✔ Business context
✔ ERP-safe answers
7️⃣ Retrieval-Augmented Generation (RAG) Pattern
SQL retrieves context → AI generates answer.
Step 1 – Retrieve context:
SELECT doc_text
FROM erp_vector_store
ORDER BY VECTOR_DISTANCE(
embedding,
:query_embedding,
COSINE
)
FETCH FIRST 3 ROWS ONLY;
Step 2 – AI Prompt (conceptual):
You are an Oracle Procurement expert.
Use ONLY the retrieved ERP content to answer the question.
If the answer is not present, say "Not available in ERP context."
This is how Oracle 23ai enables grounded, hallucination-free AI.
8️⃣ Why Oracle 23ai Matters for ERP AI
| Feature | Oracle 23ai Advantage |
|---|---|
| Vector Storage | Native VECTOR datatype |
| Search | SQL-based similarity search |
| Security | Same ERP security model |
| Performance | ANN indexing (HNSW) |
| Integration | Works with AI Studio & ERP |
Unlike external vector databases, Oracle keeps AI and ERP data together.
Final Thought
Oracle Database 23ai turns SQL into an AI language.
By combining:
Oracle Cloud ERP
Oracle Database 23ai Vector Search
AI Studio (RAG)
ERP evolves from a transactional system into a context-aware intelligence platform.
