Skip Headers
Oracle® Database Express Edition 2 Day Plus Application Express Developer Guide
Release 2.1

Part Number B25310-01
Go to Documentation Home
Go to Book List
Book List
Go to Table of Contents
Go to Master Index
Master Index
Go to Feedback page
Contact Us

Go to previous page
Go to next page
View PDF

1 How to Create a Tabular Form

A tabular form enables users to update multiple rows in a table at once using a single page. You can use the Tabular Form Wizard to create a tabular form that contains a built-in multiple row update process. This built-in process performs optimistic locking behind the scenes to maintain the data integrity.

This tutorial explains how to create a tabular form within a new application and then how to change one of the updatable columns from a text field to a select list.

This section contains the following topics:

About the HR Account

To create the tabular form in this exercise, you need to log in to the sample database user account HR. Oracle Database Express Edition (Oracle Database XE) comes with a sample database user account called HR. This user owns a number of database tables in a sample schema that can be used to create applications for a fictional Human Resources department.

Topics in this section include:

Unlocking the HR Account

For security reasons, the HR user account is locked after installation. You need to unlock this account before you can build a new application. If you have already unlocked the HR account, go to "Creating an Application".

To unlock the sample user account:

  1. Open the Database Home Page login window:

    • On Windows, from the Start menu, select Programs (or All Programs), then Oracle Database 10g Express Edition, and then Go To Database Home Page.

    • On Linux, click the Application menu (on Gnome) or the K menu (on KDE), then point to Oracle Database 10g Express Edition, and then Go To Database Home Page.

  2. At the Database Home Page login window, enter the following information:

    • Username: Enter system for the user name.

    • Password: Enter the password that was specified when Oracle Database XE was installed.

  3. Click Login.

    The Database Home Page appears.

  4. Click the Administration icon, and then click Database Users.

  5. Click the HR schema icon to display the user information for HR. (See Figure 1-1.)

    Figure 1-1 HR Schema icon

    Description of Figure 1-1 follows
    Description of "Figure 1-1 HR Schema icon"

  6. Under Manage Database User, enter the following settings:

    • Password and Confirm Password: Enter hr for the password.

    • Account Status: Select Unlocked.

    • Roles: Ensure that both CONNECT and RESOURCE are enabled.

  7. Click Alter User.

Logging in to the HR User Account

To log in to the HR user account:

  1. Log out from the database administrator account by clicking Logout in the upper right corner of the page.

  2. In the window, click Login.

  3. In the Login window, enter hr for both the user name and password.

  4. Click Login.

    The Database Home Page appears.

Creating an Application

First, you need to create an application using the Create Application Wizard.

To create an application using the Create Application Wizard:

  1. On the Database Home Page, click the Application Builder icon.

    The Application Builder home page appears.

  2. Click Create.

  3. Select Create Application and click Next.

  4. Specify the page name.

    1. For Name, enter Tabular Form.

    2. For Application, accept the default.

    3. For Create Application, select From scratch.

    4. For Schema, accept the default.

    5. Click Next.

      Next, you need to add a page. You have the option of adding a blank page, a report, a form, a tabular form, or a report and form. For this exercise, you add one blank page.

  5. Add a blank page:

    1. Under Select Page Type, select Blank and click Add Page as shown in Figure 1-2.

      The new page appears in the list at the top of the page.

    2. Click Next.

  6. For Tabs, accept the default, One Level of Tabs, and click Next.

  7. For Copy Shared Components from Another Application, accept the default, No, and click Next.

  8. For Attributes, accept the defaults for Authentication Scheme, Language, and User Language Preference Derived From and click Next.

  9. For User Interface, select Theme 2 and click Next.

  10. Review your selections and click Create.

    The Application home page appears.

Creating a Tabular Form Using a Wizard

The Tabular Form Wizard creates a form to perform update, insert, and delete operations on multiple rows in a database table. Additionally, the wizard creates a multiple row update process that checks for MD5 checksum values before doing the update in order to prevent lost updates. The following exercise creates a tabular form on the HR table.

To create a tabular form using the Tabular Form Wizard:

  1. Navigate to the Application home page. On the Database Home Page, click the Application Builder icon.

  2. Select Tabular Form.

  3. Click Create Page.

  4. For the page type, select Form and click Next.

  5. Select Tabular Form and click Next.

  6. For Table/View Owner:

    1. From Table/View Owner, select HR.

    2. From Allowed Operations, accept the default, Update, Insert, and Delete.

    3. Click Next.

  7. For Table/View Name, select EMPLOYEES and click Next.

  8. For Displayed Columns:

    1. For Select Columns, press CTRL and select the following columns:



      This exercise limits the number of columns to optimize the display on-screen. For a real form, you would probably want to include additional columns.
    2. Click Next.

  9. For Primary Key, accept the default ID (Number) and click Next.

  10. For Source Type, accept the default, Existing trigger, and click Next.

  11. For Updatable Columns, select all columns and click Next:

  12. On Identify Page and Region Attributes:

    1. For Page, accept the default.

    2. For Page Name, enter Tabular Form.

    3. For Region Title, enter Tabular Form.

    4. For Region Template and Report Template, accept the defaults.

    5. Click Next.

  13. For Tab, accept the default, Do not use tabs, and click Next.

  14. For Button Labels:

    1. Accept the defaults for the Cancel, Delete, and Add Row buttons.

    2. For the Submit button, enter Apply Changes.

    3. Click Next.

  15. Accept the remaining defaults, click Next.

  16. Confirm your selections and click Finish.

Next, run the page to view your new form.

To run the page:

  1. Click the Run Page icon as shown in Figure 1-3.

  2. If prompted to enter a username and password:

    1. For User Name, enter hr.

    2. For Password, enter hr.

    3. Click Login.

      The tabular form appears as shown in Figure 1-4.

As shown in Figure 1-4, note the tabular form contains four buttons. Cancel, Delete, and Apply Changes display in the upper left corner and Add Row displays in the bottom right corner. Additionally, a check box appears to the left of each row enabling the users to select one row. Users can also select all rows at once by selecting the check box to the left of the column headings. That same check box is also used in conjunction with the Delete button to identify the rows to be deleted.

Changing the Department Id Column to a Select List

When the Tabular Form Wizard creates a tabular form, updatable columns display by default as text fields. You can change this default display by editing report column attributes. In the next exercise, you change the default display of the Department Id column to a select list.

To change the default display of a column to a select list:

  1. Navigate to the Page Definition for page 2. Click Edit Page 2 on the Developer toolbar as shown in Figure 1-5.

    Figure 1-5 Developer Toolbar

    Description of Figure 1-5 follows
    Description of "Figure 1-5 Developer Toolbar"

  2. Under Regions, click Report next to Tabular Form as shown Figure 1-6.

    The Report Attributes page appears.

  3. Under Column Attributes, click the Edit icon next to the DEPARTMENT_ID column as shown in Figure 1-7.

    Figure 1-7 Column Attributes

    Description of Figure 1-7 follows
    Description of "Figure 1-7 Column Attributes"

    The Column Attributes page appears. Next, change the default display of this column to a select list.

  4. Scroll down to Tabular Form Element.

  5. From Display As, select Select List (query based LOV).

    Next, create your query.

  6. Scroll down to List of Values and enter the following in LOV Query:

    SELECT DISTINCT department_id a, department_id b FROM employees
  7. Scroll up to the top of the page and click Apply Changes.

  8. Click the Run Page icon in the upper right corner the page.

    As shown in Figure 1-8, notice the Department Id column now displays as a select list.

    Figure 1-8 Tabular Form with Department Id Column Changed to a Select List

    Description of Figure 1-8 follows
    Description of "Figure 1-8 Tabular Form with Department Id Column Changed to a Select List"


Do not modify the select list of a SQL statement of a tabular form after it has been generated. Doing so can result in a checksum error when altering data of the form and applying updates.

Consider the following example:

SELECT first_name FROM employees;

Note that this should not be altered to:

SELECT lower(first_name) FROM employees