<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Learn Oracle APEX]]></title><description><![CDATA[I write about different solution on Oracle APEX for developing enterprise grade, data driven, low code web application.]]></description><link>https://blog.anujofficial.com</link><image><url>https://cdn.hashnode.com/res/hashnode/image/upload/v1769267513159/6eadfd00-5cbd-4b10-b0f3-f61712e32ae0.png</url><title>Learn Oracle APEX</title><link>https://blog.anujofficial.com</link></image><generator>RSS for Node</generator><lastBuildDate>Wed, 15 Apr 2026 18:39:38 GMT</lastBuildDate><atom:link href="https://blog.anujofficial.com/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Oracle APEX : AJAX Callback using apex.server.process]]></title><description><![CDATA[Using AJAX Callback you can perform database actions without having your full page stuck in loading condition. Or, refresh only a part of the page without re-loading the full page (e.g. refreshing a p]]></description><link>https://blog.anujofficial.com/oracle-apex-ajax-callback-using-apex-server-process</link><guid isPermaLink="true">https://blog.anujofficial.com/oracle-apex-ajax-callback-using-apex-server-process</guid><category><![CDATA[Ajax]]></category><category><![CDATA[Apex]]></category><category><![CDATA[apex_json]]></category><dc:creator><![CDATA[Anuj Kumar Sharma]]></dc:creator><pubDate>Sat, 14 Feb 2026 05:00:00 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/69748b03785285d2b99676bb/3359a380-8a1a-42ce-8de5-8bb2876bc0f1.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Using AJAX Callback you can perform database actions without having your full page stuck in loading condition. Or, refresh only a part of the page without re-loading the full page (<em>e.g. refreshing a page item, report or dynamic content region</em>). There are primarily two ways of achieving this. One is by using "Execute Server-side Code" option under Dynamic Action. This handles everything under the hood, you just need to write the PL/SQL Code. But, if your requirement is a bit complex and difficult to achieve using DA then you can make custom AJAX Callbacks using <code>apex.server.process</code> <em>(an APEX JavaScript API. Check full Oracle Documentation</em> <a href="https://docs.oracle.com/en/database/oracle/apex/24.2/aexjs/apex.server.html#.process"><em>here</em></a><em>).</em></p>
<h3>How to make AJAX Callback using <code>apex.server.process</code></h3>
<p>It involves two parts.</p>
<h4>Part 1: Client-side JavaScript Code.</h4>
<pre><code class="language-javascript">apex.server.process(
    "MY_PROCESS", 
    {
        x01: "val1",
        pageItems: "#P02_PAGE_ITEM_01,#P02_PAGE_ITEM_02"
    },
    {
        loadingIndicator: \(("#div-box-id-"+\)v("P10_PARENT_EXP_ID")),
		success: function( data)
        {
            console.log(data.ajaxResponse01); // This is how to get the data returned from ajax callback.
         // code to run on success
		},
        error: function( jqXHR, textStatus, errorThrown ) 
        {
         // handle error
        }
    }
);
</code></pre>
<p>Above JavaScript code I am passing three parameters to <code>apex.server.process</code> API.<br />1st parameter <code>"MY_PROCESS"</code> is the name of my Ajax Callback PL/SQL process. It can be a page process or an Application Process. Create a page process at Execution point - "Ajax Callback" as shown in below screenshot.<br />2nd parameter takes Input values that can be used on Server-side PL/SQL side. It can be page items or other values using Xnn or Fnn properties. (<em>Check limits</em> <a href="https://docs.oracle.com/en/database/oracle/apex/24.2/aexjs/apex.server.html#.process"><em>here</em></a>).<br />3rd parameter primarily handles the response. It does more than just handling the response. You can show loading indicator on the regions or page items selected using JQuery and set to <code>loadingIndicator</code> property. (<em>Check more properties</em> <a href="https://docs.oracle.com/en/database/oracle/apex/24.2/aexjs/apex.server.html#.process"><em>here</em></a>).</p>
<img src="https://cdn.hashnode.com/uploads/covers/69748b03785285d2b99676bb/43111d5d-1915-4893-81a9-12d353ae296e.png" alt="" style="display:block;margin:0 auto" />

<p>What to put inside the Ajax Callback PL/SQL code is explained in Part 2. Before that let's cover the other parameters of the JavaScript API.<br />Second Parameter takes the values that we want to pass <em>(or submit)</em> to the Server-side PL/SQL code. Everything is explained <a href="https://docs.oracle.com/en/database/oracle/apex/24.2/aexjs/apex.server.html#.process"><em>here.</em></a></p>
<h4>Part 2: Server-side PL/SQL Code</h4>
<pre><code class="language-sql">DECLARE
		L_INPUT_01 VARCHAR2(200) := :P02_PAGE_ITEM_01; -- Only those page items can be referenced which are passed by the JavaScript AJAX Call.
        L_INPUT_02 VARCHAR2(200) := :P02_PAGE_ITEM_02;
		L_INPUT_03 VARCHAR2(200) := APEX_APPLICATION.GX01; -- Other method to pass values from Ajax callback JavaScript Code
	BEGIN
		-------
		Code
		-------
		 
		APEX_JSON.OPEN_OBJECT();
		APEX_JSON.WRITE('ajaxResponse01','l_response_01');
		APEX_JSON.WRITE('ajaxResponse02',' '||'l_response_02'); -- Concatenated extra space to the response value, as null response does not get sent.  Beware, It causes value comparison issues  later.
		APEX_JSON.CLOSE_OBJECT()
		 
	EXCEPTION
	    WHEN OTHERS THEN
	        APEX_JSON.OPEN_OBJECT();
	        APEX_JSON.WRITE('ERROR',L_LOG_MESSAGE ||'|--|'||SUBSTR(SQLERRM,1,200));
	        APEX_JSON.CLOSE_OBJECT();
	END;
</code></pre>
]]></content:encoded></item><item><title><![CDATA[Oracle APEX: How to Programmatically Switch Tabs using jQuery]]></title><description><![CDATA[There is no predefined Dynamic Action for switching tabs in Oracle APEX. Therefore, we need to use jQuery to identify the tab and the click() method to simulate the click.
The code below simulates a click on 2nd tab and opens it.
$('#myRegion li.t-Ta...]]></description><link>https://blog.anujofficial.com/oracle-apex-switch-tabs-using-jquery</link><guid isPermaLink="true">https://blog.anujofficial.com/oracle-apex-switch-tabs-using-jquery</guid><category><![CDATA[oracleapex]]></category><category><![CDATA[jQuery]]></category><category><![CDATA[tabs]]></category><category><![CDATA[JavaScript]]></category><dc:creator><![CDATA[Anuj Kumar Sharma]]></dc:creator><pubDate>Fri, 06 Feb 2026 18:30:00 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1770651055803/09d79a8a-1573-4b7f-a6ea-2611c2365a64.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>There is no predefined Dynamic Action for switching tabs in Oracle APEX. Therefore, we need to use jQuery to identify the tab and the <code>click()</code> method to simulate the click.</p>
<p>The code below simulates a click on 2nd tab and opens it.</p>
<pre><code class="lang-javascript">$(<span class="hljs-string">'#myRegion li.t-Tabs-item:eq(1) a'</span>).click();
</code></pre>
<ol>
<li><p><code>#myRegion</code> is the static ID of the specific tab region which can be defined at » <em>Right pane of your tab region » Advanced » Static ID</em></p>
</li>
<li><p>We have put <code>:eq(1)</code> to acces 2nd tab because, indexing in JavaScript starts with <code>0</code> and the 1st item (tab) is at index 0, 2nd tab is at index 1 and so on….</p>
</li>
</ol>
<h3 id="heading-how-to-use-this">How to use this?</h3>
<p>You can use this script to switch to a specific tab automatically based on user actions like:</p>
<ol>
<li><p>Click on a URL.</p>
<pre><code class="lang-xml"> <span class="hljs-tag">&lt;<span class="hljs-name">a</span> <span class="hljs-attr">href</span>=<span class="hljs-string">"#"</span> <span class="hljs-attr">onClick</span>=<span class="hljs-string">"$('#myRegion li.t-Tabs-item:eq(1) a').click(); return false;"</span>&gt;</span> Click Here <span class="hljs-tag">&lt;/<span class="hljs-name">a</span>&gt;</span>
</code></pre>
</li>
<li><p>Click on a Button.</p>
<p> Create a Dynamic Action with action type <code>Execute JavaScript Code</code> and use the same JS code there.</p>
</li>
<li><p>Click on a link or buttion attached to an event listner or any other custom code..</p>
</li>
</ol>
<p>Check <a target="_blank" href="https://blog.anujofficial.com/creating-and-using-event-listeners-in-oracle-apex">this</a> post if you are interested to know how to create and use Event listeners Oracle APEX.</p>
]]></content:encoded></item><item><title><![CDATA[Creating and Using Event listeners in Oracle APEX]]></title><description><![CDATA[What are Event Listeners?
Event listeners are the JavaScript code waiting to be executed as soon as the associated event gets triggered from the UI (e.g. User click on button or URL).
When to use cust]]></description><link>https://blog.anujofficial.com/creating-and-using-event-listeners-in-oracle-apex</link><guid isPermaLink="true">https://blog.anujofficial.com/creating-and-using-event-listeners-in-oracle-apex</guid><category><![CDATA[eventlisteners]]></category><category><![CDATA[#oracle-apex]]></category><category><![CDATA[oracleapex]]></category><dc:creator><![CDATA[Anuj Kumar Sharma]]></dc:creator><pubDate>Mon, 26 Jan 2026 13:29:10 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/69748b03785285d2b99676bb/b9613c62-33b2-486f-b998-041800f7a955.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h3>What are Event Listeners?</h3>
<p>Event listeners are the JavaScript code waiting to be executed as soon as the associated event gets triggered from the UI (e.g. User click on button or URL).</p>
<h3>When to use custom Event Listeners?</h3>
<ol>
<li><p>(On client side) You want to execute a JavaScript Code when user clicks on your custom created Button or URL.</p>
</li>
<li><p>(optional) You also need to pass values from that button or URL to the JavaScript code you want to execute.</p>
</li>
<li><p>You are not able to achieve this using Dynamic Action or It’s getting too complex that way.</p>
</li>
</ol>
<h3>How to Create?</h3>
<p>Event Listeners can be created by putting below code in page header attribute named “<strong>Execute when page loads</strong>”.</p>
<pre><code class="language-javascript">apex.jQuery(window).on('theme42ready', () =&gt; { // This line ensures that Theme42ready has loaded completely before proceeding
    var contextObjectName = apex.actions.createContext("ContextGroupName",$("#ContextElementID")); //creating a context to eliminate conflicts
    contextObjectName.add([
					{
						name : 'event-name',
						Label : 'Event Label',
						action: (event, element, args) =&gt; {
							var var1 = args.j_event_passed_value_1;
							//-------my code ------
							//--AJAX Call
						}
						 
					},
					{
                        //multiple event listeners can be added to the list
                        name : 'event-two',
                        Label : 'Event Two',
                        action : (event, element, args) =&gt; {
                            var var1 = args.j_event_passed_value_1;
                            //--------my code -----
                    }
    ]);
};
</code></pre>
<h3>How to call (use)?</h3>
<ol>
<li><p>Using Button action </p>
<pre><code class="language-xml">&lt;button 
    type="button" 
    title="Button Title" 
    data-action="action-name?j_event_passed_value_1=value1&amp;j_event_passed_value_2=value2"
&gt; Text inside button &lt;/button&gt;
</code></pre>
</li>
<li><p>Using Hyper-Link anchor tag <a></a></p>
<pre><code class="language-xml">&lt;a 
    href="#action$action-name?j_event_passed_value_1=value_1&amp;j_event_passed_value_2=value_2"
&gt; Link Text &lt;/a&gt;
</code></pre>
<p>You can also put <code>#action$action-name?jevent_passed_value_1=value_1</code> in place of URL of declaratively created button after setting the button behavior to <code>Redirect to a page in same application</code>.</p>
</li>
</ol>
]]></content:encoded></item><item><title><![CDATA[Showing Success and Error Messages in Oracle APEX Made Easy]]></title><description><![CDATA[Using PL/SQL
Soft validation error - Does not crash page, adds to stack, for business rule validation failure message. (for more check apex_error).
apex_error.add_error (
    p_message          => 'Username should not contain numbers',
    p_display_...]]></description><link>https://blog.anujofficial.com/success-and-error-messages-oracle-apex</link><guid isPermaLink="true">https://blog.anujofficial.com/success-and-error-messages-oracle-apex</guid><category><![CDATA[#oracle-apex]]></category><category><![CDATA[Apex]]></category><dc:creator><![CDATA[Anuj Kumar Sharma]]></dc:creator><pubDate>Fri, 23 Jan 2026 18:30:00 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1770708665360/07b0c814-611a-4884-9522-cc1538f8cc6f.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h3 id="heading-using-plsql"><strong>Using PL/SQL</strong></h3>
<p><strong>Soft validation error</strong> - Does not crash page, adds to stack, for business rule validation failure message. (for more check <a target="_blank" href="https://docs.oracle.com/en/database/oracle/apex/24.2/aeapi/APEX_ERROR.html">apex_error</a>).</p>
<pre><code class="lang-sql">apex_error.add_error (
    p_message          =&gt; 'Username should not contain numbers',
    p_display_location =&gt; apex_error.c_inline_in_notification,
    p_page_item_name   =&gt; 'P3_USERNAME'
);
</code></pre>
<p><strong>Hard Stop Exception</strong> - Crashes execution immediately, only for critical technical errors</p>
<pre><code class="lang-sql"><span class="hljs-comment">-- Range must be between -20999 and -20000</span>
RAISE_APPLICATION_ERROR(-20001, 'Critical Error: Authorization Failed');
</code></pre>
<p><strong>Success Message after page submit -</strong> To be used in page processes, Display on next page load.</p>
<pre><code class="lang-sql">APEX_APPLICATION.G_PRINT_SUCCESS_MESSAGE := 'Record Saved Successfully.';
</code></pre>
<p>Better way to show <strong>static success message</strong> after page submit is to put it in the <code>success message</code> attribute of the page process. If you want to make success message dynamic (e.g. “Row ID - XXXX processed!”), return the row_id value in a hidden page item (let PX_ROW_ID) and define the <code>success message</code> attribute value like - <code>Row ID - &amp;PX_ROW_ID. processed!</code>.</p>
<p>Check example use <a target="_blank" href="https://oracleapex.com/ords/r/anujs_workspace/technuj/success-and-error-messages?session=103542066171277">here</a>.</p>
<h3 id="heading-using-apex-javascript-api-apexmessage">Using apex JavaScript API <code>apex.message</code>.</h3>
<p>Show and clear errors using JS</p>
<pre><code class="lang-javascript">apex.message.showErrors([{
    <span class="hljs-attr">type</span>:       <span class="hljs-string">"error"</span>,
    <span class="hljs-attr">location</span>:   [ <span class="hljs-string">"page"</span>, <span class="hljs-string">"inline"</span> ],
    <span class="hljs-attr">pageItem</span>:   <span class="hljs-string">"P10_ITEM_NAME"</span>,
    <span class="hljs-attr">message</span>:    <span class="hljs-string">"Value must be greater than 0"</span>,
    <span class="hljs-attr">unsafe</span>:     <span class="hljs-literal">false</span>
}]);
apex.message.clearErrors();
</code></pre>
<p>Show and clear Success messages using JS</p>
<pre><code class="lang-javascript">apex.message.showPageSuccess(<span class="hljs-string">"Process Completed Successfully!"</span>);

<span class="hljs-comment">// auto dissmiss duration can be set by putting below code into "Execute When Page Loads" section of page header.</span>
apex.message.setDismissPreferences({
    <span class="hljs-attr">dismissPageSuccess</span>: <span class="hljs-literal">true</span>,
    <span class="hljs-attr">dismissPageSuccessDuration</span>: <span class="hljs-number">3000</span> <span class="hljs-comment">// Duration in milliseconds (3 seconds)</span>
});
</code></pre>
<p><strong>Referances</strong> - <a target="_blank" href="https://docs.oracle.com/en/database/oracle/apex/24.2/aexjs/apex.message.html">apex.message</a></p>
]]></content:encoded></item></channel></rss>