Use Cases
UC AI lets you call large language models (LLMs) directly from PL/SQL β no Python, no separate AI service, no copying data out of your database. That opens up a lot of practical automation right where your data already lives.
This page is a tour of what teams actually build with it. Each use case starts with the business outcome, then shows roughly how it looks in code. You do not need to read the code to understand the value β skim the bold outcomes first.
How it works
Section titled βHow it worksβEverything runs inside your database. UC AI takes a prompt (and optionally your data and tools), calls the AI provider you choose, and hands the answer back to your PL/SQL β so results can go straight into your tables or APEX pages.
βββββββββββββββββββββββββββββ ββββββββββββββββββββ β Your Oracle Database β β AI Provider β β + APEX app β β (OpenAI, β β β β Anthropic, β β ββββββββββββββββββββββββ β HTTPS β Google, OCI, β β β UC AI (PL/SQL) ββΌβββΌββββββββΆβ Ollama, ...) β β β generate_text() ββΌβββΌβββββββββ€ β β βββββββββ¬βββββββββββββββ β ββββββββββββββββββββ β β tools call back β βΌ β Your data never leaves β Your tables & functions β the database unless you β (read + write) β choose to send it. βββββββββββββββββββββββββββββThe AI can only touch your data through tools β PL/SQL functions you explicitly register β so you stay in control of exactly what it can read and do.
1. Classify and route incoming records
Section titled β1. Classify and route incoming recordsβOutcome: Automatically tag support tickets, emails, or feedback by topic, urgency, or sentiment β and route them to the right queue β without a human triaging each one.
Use structured output so the model returns clean JSON you can insert straight into a column:
declare l_result json_object_t; l_schema json_object_t := json_object_t('{ "type": "object", "properties": { "category": { "type": "string", "enum": ["billing", "technical", "sales", "other"] }, "urgency": { "type": "string", "enum": ["low", "medium", "high"] }, "summary": { "type": "string", "description": "One-sentence summary" } }, "required": ["category", "urgency", "summary"] }');begin l_result := uc_ai.generate_text( p_user_prompt => 'Ticket: "The invoice total looks wrong and I was charged twice."', p_provider => uc_ai.c_provider_openai, p_model => uc_ai_openai.c_model_gpt_5_6_luna, p_response_json_schema => l_schema ); -- l_result.get_clob('final_message') is guaranteed to match the schema.end;/2. Answer questions about your documents (PDF / image analysis)
Section titled β2. Answer questions about your documents (PDF / image analysis)βOutcome: Let users ask questions about a scanned invoice, a contract, or a product photo β and get answers grounded in the fileβs actual content.
UC AI can send PDFs and images to models that support them. You attach the file (straight from a BLOB column) to a message and ask your question. See the File Analysis guide for the full example:
-- Build a user message that combines the file with a questionl_content.append(uc_ai_message_api.create_file_content( p_media_type => 'application/pdf', p_data_blob => (select blob_content from your_table where id = 1), p_filename => 'contract.pdf'));l_content.append(uc_ai_message_api.create_text_content( 'Summarize this contract and list any payment deadlines.'));l_messages.append(uc_ai_message_api.create_user_message(l_content));
l_result := uc_ai_google.generate_text( p_messages => l_messages, p_model => uc_ai_google.c_model_gemini_3_7_flash);3. Enrich and clean up data
Section titled β3. Enrich and clean up dataβOutcome: Turn messy free-text columns into structured, queryable data β extract addresses, normalize product names, generate short descriptions, or translate content β in a batch job over your tables.
Loop over rows and call generate_text with a structured-output schema, then write the result back. Because it is all PL/SQL, this is just a cursor and an UPDATE β no external pipeline to maintain.
4. Build an in-database assistant over your own data
Section titled β4. Build an in-database assistant over your own dataβOutcome: A chatbot or natural-language search that answers questions like βHow many open tickets does Jim have?β by actually querying your live tables β not a stale export.
This uses tools: you register PL/SQL functions the model can call, and it decides when to use them.
begin uc_ai.g_enable_tools := true;
l_result := uc_ai.generate_text( p_user_prompt => 'What is the email address of Jim?', p_system_prompt => 'You are an assistant to a time tracking system. Use the provided tools to access user, project and timetracking data.', p_provider => uc_ai.c_provider_anthropic, p_model => uc_ai_anthropic.c_model_claude_4_5_haiku ); -- "Jim's email address is jim.halpert@dundermifflin.com."end;/The same pattern lets the assistant take action β clock someone in, create a record, trigger a REST call β through tools you control.
5. Automate multi-step workflows with agents
Section titled β5. Automate multi-step workflows with agentsβOutcome: Hand off a goal (βresearch this customer and draft an onboarding emailβ) to an agent that plans, calls several tools, and produces a finished result β or coordinate several specialized agents.
See the Agentic AI and Multi-Agent Systems guides for orchestrator, workflow, and conversation patterns.
6. Semantic search and RAG
Section titled β6. Semantic search and RAGβOutcome: βFind me documents about Xβ that understands meaning, not just keywords β the foundation for retrieval-augmented generation (RAG) over your own content.
Generate embeddings (vectors) for your text and store them for similarity search β on 23ai/26ai using the native VECTOR type, or on older databases via any vector store:
l_vectors := uc_ai.generate_embeddings( p_input => json_array_t('["First document chunk", "Second document chunk"]'), p_provider => uc_ai.c_provider_openai, p_model => uc_ai_openai.c_model_text_embedding_3_small);See the Generate Embeddings reference for converting results to the Oracle VECTOR type.
Not sure where to start?
Section titled βNot sure where to start?β- Just exploring? Watch the UC Live webinar or read Philippβs blog post on real AI solutions in PL/SQL.
- Want to see it running? Grab the sample APEX app.
- Ready to build? Follow the Quickstart.