NotesSelect AINL2SQLAI

Select AI semantic context: text-to-SQL fails on meaning, not syntax

Select AI semantic context adds business definitions to text-to-SQL prompts. Attach it to a profile, then check it with SELECT AI SHOWCONTEXT.

Ask an LLM for "at-risk customers" and it has to guess what "at-risk" means in your business. Your schema can't tell it. On 23 October Oracle detailed its answer for Select AI. It's called semantic context, and it adds business knowledge to natural-language-to-SQL prompts alongside the schema metadata.

How it works

  • Create a semantic source with DBMS_AI_SEM.CREATE_SEMANTIC_SOURCE.
  • Choose from five source types: catalog (Alation and Informatica are supported), file (a glossary or metric guide), custom (PL/SQL functions that return context), MCP and ontology.
  • Attach sources to an AI profile through its semantic_source attribute. A source only applies to prompts that use a profile it's attached to.
  • Debug with SELECT AI SHOWCONTEXT to see the object, column and global context used for a prompt.
  • Share a source with other profile owners when needed. Sharing doesn't transfer ownership or the source's credential.

Before you tune prompts

Write down the 20 business terms your team argues about most ("active", "high-value", "churned"). That glossary is now an input to your AI, not just a wiki page. Oracle hasn't yet listed which Select AI releases include semantic context, so check your release first.

My take: give business terms an owner and review changes to them like schema changes, because a wrong definition now produces wrong SQL with no error. Source: Give Oracle Select AI the Business Context Behind Your Data.

Get the Oracle + AI digest

One email when a new tested guide, template or APEX release note lands — English or Arabic. No spam; unsubscribe anytime.