Oracle Apex - Simple Form

1 - About

A simple form (ie not Oracle Apex - Tabular Form)

3 - Creation

4 - Steps

4.1 - Populating

A form can be populated either:

  • on load with PL/SQL
  • or with an Automatic Row Fetch

4.1.1 - Automatic Row Fetch

  • Step 1 - Create an HTML region (to serve as a container for your page items).
  • Step 2 - Create items to display in the region (Always overrides the cache value)

4.1.2 - Programmatically

  • Step 1 - Create an HTML region (to serve as a container for your page items).
  • Step 2 - Create items to display in the region (Only when current value in session state is null)
  • Step 3 - Populate the form programmatically with a PL/SQL process that executes (or fire) on a before Onload - Before Regions.

Example:


FOR C1 in (SELECT ename, sal
FROM emp WHERE ID=:P2_ID)
LOOP     
     :P2_ENAME := C1.ename;
     :P2_SAL := C1.sal;
END LOOP;

where:

  • The values of :P2_ENAME and :P2_SAL are being populated
  • The value of P2_ID is already known (a hidden session state item named P2_ID)
  • C1 is an implicit cursor.

4.2 - Processing

There are three ways to process a simple form:

4.2.1 - Automatic Row Processing (DML)

4.2.2 - Process with One or More Statements

One or more processes are created to handle insert, update, and delete actions.

4.2.2.1 - Insertion

To process the insertion of a new row, you create a conditional process of type PL/SQL that executes when the user clicks the Insert button. For example:


BEGIN
  INSERT INTO T ( first_name, last_name )
     VALUES  (:P1_FIRST_NAME, :P1_LAST_NAME);
END; 

4.2.2.2 - Update

To process the updating of a row, you create another conditional process of type PL/SQL. For example:


BEGIN
    UPDATE T
       SET first_name = :P1_FIRST_NAME,
           last_name = :P1_LAST_NAME
    WHERE ID = :P1_ID;
END; 

4.2.2.3 - Delete

To process the deletion of a row, you create a conditional process that executes when the user clicks the Delete button. For example:


BEGIN
    DELETE FROM T
    WHERE ID = :P1_ID;
END;

4.2.3 - PL/SQL Package

If you created a package to handle DML operations, you can call procedures and functions within this package from an After Submit PL/SQL process to process insert, updates, and delete requests.

5 - Documentation / Refernce


Data Science
Data Analysis
Statistics
Data Science
Linear Algebra Mathematics
Trigonometry

Powered by ComboStrap