Display a Value From Another Table on Page Load in Oracle Apex

In this tutorial, I am giving an example to display a value from another table on page load in Oracle Apex using the Process.

Suppose you have a form based on Employee information and there is a field Department Number which refers to DEPT table. You require to display the department name from DEPT table whenever a form is opened in EDIT mode. To perform this task, follow these steps:

Oracle Apex Process Example - Display a Value from Another Table on Page Load

Step-1: Create a page item next to Department number item and set the type of the item as Display Only.

Step-2: Create a process in before header section and set the following properties as shown in the below image:

Oracle Apex process example.

Enter the following PL/SQL code in the above PL/SQL code section:

declare
v_dname dept.dname%type;
begin
  select dname into v_dname
    from dept where deptno = :p3_deptno;
    
    apex_util.set_session_state('P3_DNAME', v_dname);
    exception
      when others then
        null;
end;

Now when you will open the form, it will display the department name value as shown in the below image:

Oracle Apex - display value from another table example

See also:

Vinish Kapoor
Vinish Kapoor

Vinish Kapoor is a seasoned software development professional and a fervent enthusiast of artificial intelligence (AI). His impressive career spans over 20 years, marked by a relentless pursuit of innovation and excellence in the field of information technology. As an Oracle ACE, Vinish has distinguished himself as a leading expert in Oracle technologies, a title awarded to individuals who have demonstrated their deep commitment, leadership, and expertise in the Oracle community.