Skip to main content

Oracle APEX Useful Queries Every Developer Should Know

 

 Introduction

In real-world Oracle APEX applications, developers often face challenges diagnosing performance issues, auditing components, and monitoring activity.

Oracle APEX provides a rich set of internal views that can help diagnose, monitor, and optimize applications. This guide transforms commonly used queries into practical, real-world solutions with insights and best practices.

1) Identify Slow Pages

Problem

Users report that some pages are slow, but it's unclear which ones are causing performance issues.

Solution

SELECT APPLICATION_ID,

       PAGE_ID,

       COUNT(*)                        AS EXECUTIONS,

       ROUND(AVG(ELAPSED_TIME), 2)     AS AVG_SECONDS,

       ROUND(MAX(ELAPSED_TIME), 2)     AS MAX_SECONDS

FROM   APEX_WORKSPACE_ACTIVITY_LOG

WHERE  VIEW_DATE >= SYSDATE - 30

GROUP BY APPLICATION_ID, PAGE_ID

ORDER BY AVG_SECONDS DESC

FETCH FIRST 20 ROWS ONLY;

2) Application & Workspace Info

 APEX applications in workspace

SELECT APPLICATION_ID,

       APPLICATION_NAME,

       ALIAS,

       LAST_UPDATED_ON,

       LAST_UPDATED_BY,

       VERSION

FROM   APEX_APPLICATIONS

ORDER BY APPLICATION_ID;

  APEX version installed

SELECT VERSION_NO,

       API_COMPATIBILITY,

       PATCH_APPLIED

FROM   APEX_RELEASE;

 All workspaces Detail

SELECT WORKSPACE_ID,

       WORKSPACE,

       WORKSPACE_DISPLAY_NAME

FROM   APEX_WORKSPACES;

3)   Pages & Components

All Pages in an Application

Note : Get App_id from query APEX applications in workspace in our example we use app_id =102

SELECT PAGE_ID,

       PAGE_NAME,

       PAGE_ALIAS,

       PAGE_MODE,

       AUTHORIZATION_SCHEME,

       LAST_UPDATED_BY,

       LAST_UPDATED_ON

FROM   APEX_APPLICATION_PAGES

WHERE  APPLICATION_ID =:APP_ID

ORDER BY PAGE_ID;


All Interactive Reports in an Application

Note : Get App_id from query APEX applications in workspace in our example we use app_id =102

SELECT PAGE_ID,

       REGION_NAME,

       SQL_QUERY

FROM   APEX_APPLICATION_PAGE_IR

WHERE  APPLICATION_ID = :APP_ID;

 

 All page items (fields/inputs)

Note : Get App_id from query APEX applications in workspace in our example we use app_id =102

 SELECT PAGE_ID,

       ITEM_NAME,

       DISPLAY_AS,

       ITEM_DEFAULT

FROM   APEX_APPLICATION_PAGE_ITEMS

WHERE  APPLICATION_ID = :APP_ID

ORDER BY PAGE_ID, ITEM_NAME;

4) Activity Monitoring

Most Visited Pages (Last 20 Days)

SELECT APPLICATION_ID,

       PAGE_ID,

       COUNT(*)        AS HITS,

       MAX(VIEW_DATE)  AS LAST_VISITED

FROM   APEX_WORKSPACE_ACTIVITY_LOG

WHERE  VIEW_DATE >= SYSDATE - 20

GROUP BY APPLICATION_ID, PAGE_ID

ORDER BY HITS DESC

FETCH FIRST 20 ROWS ONLY;

5) Page Validations 

 Note : Get App_id from query APEX applications in workspace in our example we use app_id =102

  All validations

SELECT PAGE_ID,

       VALIDATION_NAME,

       VALIDATION_TYPE,

       VALIDATION_EXPRESSION1,

       ERROR_MESSAGE

FROM   APEX_APPLICATION_PAGE_VAL

WHERE  APPLICATION_ID = :APP_ID

ORDER BY PAGE_ID;

 6) List of Values (LOVs)

Note : Get App_id from query APEX applications in workspace in our example we use app_id =102

All LOVs in an application

SELECT LIST_OF_VALUES_NAME,

       LIST_OF_VALUES_QUERY,

       SOURCE_TYPE

FROM   APEX_APPLICATION_LOVS

WHERE  APPLICATION_ID = :APP_ID

ORDER BY LIST_OF_VALUES_NAME;

Conclusion

 Oracle APEX's internal views unlock a level of visibility that most developers need. Whether you're diagnosing slow page renders, auditing session state, or tracking workspace activity, these views give you direct access to the data APEX itself relies on.

                      

 







Comments

Popular posts from this blog

Oracle R12 Inventory Configuration: Key points to Avoid Mistakes

Most Oracle ERP R12 inventory problems are not system failures they are process and configuration failures. The same categories of mistakes surface repeatedly across implementations: Focusing on master data control, disciplined transactions, proper OU setup, and strong internal controls prevents operational and financial discrepancies.   This article walks through the four most critical areas where Oracle R12 inventory implementations go wrong, explains why each mistake is costly, and provides recommendations to prevent them. Each section includes the relevant navigation path and configuration screenshots for hands-on reference   1.       Improper Item Master Configuration in Oracle R12   Oracle E‑Business Suite R12 , the Item Master Configuration serves as the foundation of the Inventory module. Two critical components under this configuration umbrella are: Define Master Item Setup Define Item Status Both setups control how items ...

Monitoring and Troubleshooting Oracle APEX Performance with Real-World SQL Queries

    Introduction Oracle Application Express (APEX) is one of the most widely adopted low-code development platforms in the Oracle ecosystem. As organizations scale their APEX deployments, the need for robust monitoring and troubleshooting capabilities becomes critical. This article provides SQL queries that DBAs and developers can use to monitor, diagnose, and optimize their APEX environments.   What makes monitoring APEX unique is the three-tier architecture it operates on: the Oracle Database at the data layer, APEX at the application layer, and Oracle REST Data Services (ORDS) as the middleware. Understanding how sessions flow through these three layers is the key to effective monitoring.     Architecture Overview   Layer Component Version Role Database Oracle DB 19.28 Stores data, executes SQL, manages sessions Application Oracle AP...
SQL Query Performance Tuning: A Practical Approach for Oracle DBAs Inefficient queries in Oracle Database can significantly impact system performance, resulting in higher response times and decreased user productivity. By closely monitoring memory usage and CPU consumption, database administrators can identify performance bottlenecks and determine the root causes of inefficient query execution. Oracle Query Performance Tuning Checklist 1.          Monitor Memory Usage:                Purpose: Ensure optimal memory allocation to prevent excessive disk I/O and performance degradation.             Actions: * Track memory consumption using Oracle Enterprise Manager *Automatic Workload Repository (AWR) reports to review SGA and PGA utilization, and identify abnormal memory usage patterns. Analyze AWR reports for: a.   ...