AI

Oracle APEX AI: the AI Assistant & generative app building

Turn on APEX's built-in AI — APEX Assistant in the builder's code editors, Create App Using Generative AI, the Show AI Assistant dynamic action and the APEX_AI package — and wire it to a provider.

Beginner⏱ 3 min readUpdated: 2026-10-10

Since APEX 24.1, generative AI is built into the builder and into the apps you ship. This guide (checked against APEX 26.1 and 26.2) connects a provider and tours the places you'll use it: APEX Assistant in the code editors, Create App Using Generative AI, and AI inside your own apps via the Show AI Assistant dynamic action and the APEX_AI package.

Connect a Generative AI service

  1. Go to App Builder → Workspace Utilities → Generative AI and click Create. (Also reachable from an app's Shared Components → Generative AI → AI Services.)
  2. Pick the AI Provider: OCI Generative AI, OpenAI, Cohere, Google Gemini, Anthropic Claude, Mistral AI, Ollama, or a generic OpenAI-compatible endpoint (26.1 list).
  3. Give it a Name and a Static ID — the Static ID is what you pass to APEX_AI.
  4. Under Credentials, enter the provider's API Key (or select an existing Web Credential). Optionally set the AI Model (under Advanced in 26.1); if empty, the provider's default model is used.
  5. Switch on Used by App Builder if the builder's own AI features should use this service. Only one service per workspace can have it on.
  6. Click Test Connection (expect *Connection Succeeded!*), then Create.

ℹ Workspace service, per-app choice

Services are defined once per workspace. The builder uses the one marked Used by App Builder; each application chooses its own service under Edit Application Definition → AI (along with the user Consent Message). An instance administrator can switch AI off for the whole instance (Manage Instance → Instance Settings → Security → AI Enabled) or for individual workspaces.

💡 New in APEX 26.2

Generative AI services get a Provider API setting: OpenAI, Ollama and OpenAI-compatible services default to Responses (Chat Completions is deprecated), Google Gemini defaults to Interactions, and OCI Generative AI keeps Generic as the default. AI Agents also get a Reasoning Effort setting.

Use APEX Assistant in the code editors

APEX Assistant is a chat pane inside the builder's code editors (for example a region's SQL source in Page Designer). Click APEX Assistant on the editor's menu bar, accept the consent dialog the first time, and pick a mode:

  • Query Builder — describe the data and get a query back: *"top 5 customers by revenue this year"*.
  • General Assistance — select code and ask *"Explain this"* or *"Improve this code"*.

⚠ Review everything

Oracle's own docs warn that AI-generated code may contain errors or security risks. Read and test every query before it reaches production.

Create an app from a prompt

Create App Using Generative AI builds pages on tables that already exist (or on a sample dataset). If you need new tables, generate them first with Create Data Model Using AI:

SQL Workshop → Utilities → Create Data Model Using AI
  › Expense tracking: employees, expenses with receipt files,
    approval status and approver, expense categories.
  → review the generated script → Run

App Builder → Create → Create App Using Generative AI
  › Create an app on the EXPENSES tables with an interactive report,
    a form, and a monthly dashboard by category.
  → review the summary → Create Application

APEX Assistant summarises the pages it plans; you refine through chat, then finish in the normal Create Application wizard. Both options are hidden until a service has Used by App Builder on. Pair it with the vibe-coding guide for the file-based workflow.

Add an AI chat to your own app

  1. Set the app's service on Edit Application Definition → AI.
  2. Optionally create an AI Agent under Shared Components → Generative AI → AI Agents for the system prompt, welcome message and AI Tools (26.1 renamed *AI Configurations* to *AI Agents*).
  3. In Page Designer, add a button and a Click dynamic action whose true action is Show AI Assistant. Choose the Agent, and set Display As to Dialog or Inline.

From PL/SQL, APEX_AI.GENERATE returns a CLOB. Both calls below compile against APEX 26.1; they must run inside an APEX session (an app process, or after APEX_SESSION.CREATE_SESSION):

declare
    l_answer clob;
begin
    -- Using a Generative AI Service by its Static ID
    l_answer := apex_ai.generate (
        p_prompt            => 'Summarize this ticket in two sentences: ' || :P10_TICKET_TEXT,
        p_system_prompt     => 'You are a concise support analyst.',
        p_service_static_id => 'MY_AI_SERVICE',
        p_temperature       => 0.2 );

    -- Or reuse an AI Agent (APEX 26.1+)
    l_answer := apex_ai.generate (
        p_agent_static_id => 'SUPPORT_AGENT',
        p_prompt          => :P10_QUESTION );
end;

Check your understanding

Check your understanding

0% · 0/3

Where is a Generative AI Service created?

Why is "Create App Using Generative AI" missing from the Create wizard?

What should you do with Assistant-generated SQL?

Need this delivered?

Request a quote