Viscosity
logo-black
  • Data
    • Database Services
      • Performance Assessment
      • Proactive Healthcheck
      • Database Migration & Consolidation
      • Performance Tuning
    • Microsoft Services
      • Microsoft Azure Services
      • Microsoft SQL Server Services
      • Microsoft Gold Azure Partner
    • Oracle Services
      • Oracle Database 19c
      • Oracle Database 23ai
      • RAC
      • GoldenGate
      • Data Guard
      • Oracle & SQL Database
    • Viscosity Remote Services
  • Apps
    • App Dev Services
    • Oracle APEX
    • Viscosity AMP
    • Viscosity-ai
    • Shane-ai
  • Cloud
    • Cloud Services
    • Hybrid Cloud
    • Viscosity Edge Cloud
    • Virtualization & Cloud Expertise
    • Microsoft Azure Services
  • Infrastructure
    • Infrastructure Services
    • Exadata
      • Exadata Resale & Services
    • Oracle Database Appliance
      • Oracle Database Appliance Resale & Services
      • ODA Health Checks
    • Zero Data Loss Recovery Appliance
    • VMware to KVM Migration
  • Events
    • Upcoming Events
    • Virtual Training
    • 2025 Past Events
    • 2024 Past Events
    • 2023 Past Events
    • 2022 Past Events
  • About
    • About Us
    • News
    • Blogs
    • Publications
    • Contact
Hit enter to search or ESC to close
ENGAGE WITH US

From Metadata to Manuscripts: How To Use AI to Generate Database Documentation

By Diego Fion
October 28, 2025

What if documenting your code was as simple as running a stored procedure?

Developers love to build — but few enjoy writing technical documentation. In this post, I’ll walk you through how I automated the generation of technical docs for Oracle APEX and PL/SQL using OpenAI, metadata queries, and a bit of creative design inside APEX.

 

 

🧠 The Problem

Every application has packages, procedures, and tables that deserve documentation — yet it’s the first thing we skip and the last thing we regret skipping.

 

 

⚙️ The Approach

Here’s what I built:

  • A simple PL/SQL package that:

    • Loops through all your objects (DBA_OBJECTS)
    • Fetches their DDL using DBMS_METADATA
    • Sends that DDL to OpenAI via REST
    • Stores the Markdown output in a versioned registry table

  • An APEX app that:

    • Lets you explore documentation by object, type, and version
    • Displays Markdown using native components
    • Supports multi-role documentation types: TECHNICAL, USER ACCEPTANCE, CI/CD

 

🧩 A Few Screenshots on How an APEX Tool Could Look

 

 

 

 

✍️ Sample Prompt (Technical)

Here’s the prompt I use for generating technical documentation:

 


You are a senior software architect. Generate concise, professional technical documentation in Markdown format for the given Oracle database object. The documentation must include:

## Purpose
- A brief paragraph describing the objective of the object.
## Structure
- Key components or logic breakdown (e.g., functions, procedures, queries).
## Parameters
- If the object accepts input, detail each parameter, its type, and purpose.
## Outputs
- What the object returns or affects (if any).
## Usage
- Common or recommended use cases.
## Notes
- Any best practices, side effects, exceptions, or important warnings.

Use headers, bullet points, and code blocks (```sql) where suitable. Maintain clarity and avoid redundant explanations or repetition.

 

You can customize prompts per documentation type. Or, let the AI assist you and get the first version.

 

 

 

🎯 Results

The result? Instantly readable, consistently formatted documentation — generated in seconds. Here’s a preview:

 

 


📚 Additional Resources

The code? You can find it on a dedicated GitHub repo.

 

 

💡 Why This Matters:

  • Saves time.
  • Could improve onboarding for new devs if implemented with team standards.
  • Keeps documentation up-to-date as code evolves.
  • Provides a starting point for developers generating their first draft.
  • Integrates directly into APEX for low friction.
  • Could be integrated with version control tools, e.g, Git.

🚀 What’s Next?

In future posts, I’ll show how to:

  • Generate user acceptance docs using test scenarios.
  • Draft new package templates with OpenAI.
  • Build data models from user stories.

 

Let AI handle that — so you can focus on what matters: building great software.

 

Got questions or ideas? Leave a comment or connect with me on Hashnode/LinkedIn.

 

 

 

Ready to Take Your Oracle Skills to the Next Level?

Master Oracle APEX – Join our Hands-On Intro to Oracle APEX course on OraPub and build powerful applications with expert guidance.

Check out Viscosity’s event page for upcoming virtual and on-site training opportunities.
OraPub Intro to APEX Course Details
Upcoming Viscosity Events

 

All posts
About Author
Diego Fion

Diego Fion is a seasoned Solutions Architect and full-stack developer with over a decade of experience designing and delivering enterprise-grade software solutions. His work spans diverse industries — from geotracking and healthcare to oil and gas, construction, engineering, and genetics — where he has helped organizations modernize their systems and harness the power of cloud and AI integration. Known for his analytical mindset and collaborative approach, Diego thrives on solving complex challenges and turning ideas into scalable, high-performing applications. With a deep background in cloud infrastructure and agile development, he’s passionate about building solutions that not only meet technical requirements but also drive real business impact.

SUBMIT YOUR COMMENT
logo footer

Viscosity's core expertise includes:

Data Transformation, Emerging Technology, High Availability & Scalability Solutions, Cloud Migrations, Performance Tuning, Data Integrations, Machine Learning, APEX Development, and Custom Application Development.


Solutions

Resources

Partnerships

Careers

Clients

 

Contact
Email: sales@viscosityna.com

Telephone:
(469) 444-1380

Address:
3016 Communications Pkwy Suite 200, Plano, TX 75093

Copyright 2025. All Rights Reserved by Viscosity North America.