Oracle DB AI: Select AI & natural-language SQL
Use Oracle 26ai's built-in AI — Select AI for NL-to-SQL, plus where Vector Search and JSON Duality fit — straight from SQL.
Intermediate⏱ 1 min readUpdated: 2026-06-10
Oracle put AI inside the database. This guide tours the DB-AI trio — Select AI (ask questions in English, get SQL), AI Vector Search and JSON Duality — and shows the fastest way to try Select AI.
Configure an AI profile
Select AI uses an *AI profile* that names a provider and which schema objects it may see.
BEGIN
DBMS_CLOUD_AI.create_profile(
profile_name => 'HR_AI',
attributes => '{"provider":"openai",
"credential_name":"AI_CRED",
"object_list":[{"owner":"HR","name":"EMP"},
{"owner":"HR","name":"DEPT"}]}');
END;
/Ask in natural language
EXEC DBMS_CLOUD_AI.set_profile('HR_AI');
SELECT AI how many employees per department earn above average;
-- see the generated SQL instead of running it
SELECT AI showsql how many employees per department earn above average;⚠ Review before you trust
Use
showsql to inspect the generated SQL — treat NL-to-SQL like any AI output: review it before relying on it for real decisions.Where the rest of DB AI fits
- AI Vector Search — semantic search and RAG over your rows (see the Vector Search guide).
- JSON Duality views — the same data as relational AND JSON documents, ideal for AI app backends.
- Select AI narrate — get a prose answer instead of rows, for chat-style apps.
Check your understanding
Check your understanding
0% · 0/2What does SELECT AI showsql do?
What scopes which tables Select AI can see?
Need this delivered?
Request a quote