APEX Application Settings Deep Dive

Search for a command to run...

Great feature. I use it frequently. Saves me from creating additional configuration tables and packages to map such settings to the users.
Oracle APEX ideas and insights that you can read in four minutes or less.
Introduction APEX Form Regions and Interactive Grids are a great way to enable Create, Update and Delete (CRUD) functionality on a table without writing any code. Enabling CRUD functionality for a table is as easy as following the Create Page Wizard ...
Introduction One of the marquee features of APEX 26.1 was AI Interactive Reports. When I started testing this new feature, I was interested to see what was going on behind the scenes. In this post, I

Introduction One of the marquee features of APEX 26.1 is APEX AI Agents. APEX AI Agents allow you to use an LLM and your own PL/SQL and JS tools to perform actions on your data instead of just chattin

Introduction In my previous post, I looked at logging APEX AI Agent requests and responses with Request and Response handlers. Logging is the first step because it shows you what is actually moving th

Introduction Logging is one of the first things you need when building serious AI Agents. Without it, debugging quickly becomes guesswork. You can see the final answer, but not always why the model ch

Context management patterns from building agents in Oracle APEX

APEX Application Settings offer a convenient way to store values specific to an APEX Application. APEX Application Settings are configured in APEX Builder under Shared Components > Application Settings.
This post will describe how Application Settings work and how you can get and set values for them using the APEX_APP_SETTING PL/SQL API.
APEX Application Settings are helpful because they can be used to store Application specific values that can be updated via APEX Builder or a PL/SQL API. These capabilities allow you to expose settings that would usually be treated as constants, provide visibility to them, and update them under appropriate circumstances. APEX Application Settings have many uses, including:
Let's start by creating an Application Setting. After Navigating to Shared Components > Application Settings, click the 'Create Setting >' button.

Let's examine the attributes in more detail:
NameValueValue RequiredValid ValuesOn Upgrade KeepSo, what happens when you deploy an application with an Application Setting? The behavior is governed by the attribute On Upgrade Keep. 💡I wish this attribute had been named On Deployment Keep Value.
If On Upgrade Keep is on for an Application Setting:
If On Upgrade Keep is off for an Application Setting:
The APEX_APP_SETTING PL/SQL APIs help us interact with Application Settings from PL/SQL. Note: You must have an APEX Session established to call these APIs. Requiring an APEX session means if you are calling these APIs outside of APEX, you must first call apex_session.create_session or apex_session.attach.
The apex_app_setting.get_value function is simple to use.
DECLARE
l_email_enabled VARCHAR2(1);
BEGIN
-- Create an APEX Session (required if not calling from APEX)
apex_session.create_session
(p_app_id => 109,
p_page_id => 1,
p_username => 'CNDEMO');
-- Get the Application Setting Value.
l_email_enabled :=
apex_app_setting.get_value
(p_name => 'EMAIL_ENABLED',
p_raise_error => TRUE));
-- Clean up the APEX Session (only required if apex_session.create_session) is used
apex_session.delete_session ();
END;
Exceptions
If you set p_raise_error to TRUE (this is FALSE by default), then you can expect the following exceptions:
As we can see from the below example, setting the value for an Application Setting is equally simple.
BEGIN
-- Create an APEX Session (required if not calling from APEX)
apex_session.create_session
(p_app_id => 109,
p_page_id => 1,
p_username => 'CNDEMO');
-- Set the Application Setting Value.
apex_app_setting.set_value
(p_name => 'EMAIL_ENABLED',
p_value => NULL,
p_raise_error => TRUE);
-- Clean up the APEX Session (only required if apex_session.create_session) is used
apex_session.delete_session ();
END;
Exceptions
If you set p_raise_error to TRUE (this is FALSE by default), then you can expect the following exceptions:
Valid ValuesValue Required is set on, but you are not passing a valueAPEX Application Settings are a valuable tool in the APEX developer's toolbox. If you need to store Application wide settings and need the ability to allow them to be viewed or updated from your APEX Applications, then I encourage you to try them out.
Please also check out my other APEX posts: