How to Create a Multi-Row Block in Oracle Forms
One of the most practical features of Oracle Forms is the ability to display and edit multiple records simultaneously in a single block. A multi-row block is exactly that — a data block configured to show several rows of data at once, allowing users to scroll through records and update multiple rows without navigating back and forth between individual record screens.
If you have ever built a master-detail form or a grid-style data entry screen, you have used multi-row blocks. In this guide, we walk through how to create them, configure them correctly, and handle common issues.
What Is a Multi-Row Block?
By default, a new data block in Oracle Forms shows one record at a time. When you increase the Number of Records Displayed property above 1, Oracle Forms creates a grid-style layout where each row corresponds to one database record.
Multi-row blocks are ideal for:
- Detail sections in master-detail forms (e.g., order line items)
- Tabular data entry screens where users need to enter or edit many records quickly
- Summary grids that allow inline editing
- Read-only result grids after a query operation
Step-by-Step: Creating a Multi-Row Block with the Data Block Wizard
The easiest way to create a multi-row block is to use Oracle Forms Builder’s built-in Data Block Wizard.
Step 1: Launch the Data Block Wizard
In the Object Navigator, right-click on Data Blocks and choose Data Block Wizard. The wizard will walk you through connecting the block to a table or view.
Step 2: Select Your Table
Choose Table or View as the data source. Enter your table name and select the columns you want to display. For a multi-row block, you typically include the key identifiers plus the columns users will edit or review.
Step 3: Configure the Layout
On the Layout Wizard screen, choose the Tabular layout style. This is what creates the multi-row display. The Form layout (the alternative) displays one record at a time.
Set the Records Displayed value to the number of rows you want visible at once. A value of 10–15 works well for most screens.
Enable the Scrollbar option so users can scroll to additional records beyond those displayed.
Key Block Properties to Set
After the wizard completes, open the block properties and verify or set the following:
| Property | Recommended Setting | Purpose |
|---|---|---|
| Records Displayed | 10–20 depending on screen | How many rows appear at once |
| Query All Records | No (default) | Fetches records in batches for performance |
| Query Array Size | Same as Records Displayed | Fetch batch size from database |
| Insert Allowed | Yes or No based on use case | Whether new rows can be added |
| Delete Allowed | Yes or No based on use case | Whether rows can be marked for deletion |
| Record Orientation | Vertical (default) | Each record displayed as a row |
Adding a Scrollbar to the Multi-Row Block
A scrollbar allows users to navigate through records beyond what is displayed. To add one manually:
- In the Layout Editor, select your block canvas area
- From the menu, choose View → Show View to see the full canvas
- In the block’s property palette, set Show Scroll Bar to Yes
- Ensure the scrollbar object appears on the canvas and is positioned to the right of your rows
The scrollbar automatically connects to the block’s record navigation. When a user scrolls, Oracle Forms fetches additional records from the database in batches.
Handling Current Record Highlighting
In a multi-row block, users need to know which row is currently active. Oracle Forms handles this through the Current Record Visual Attribute. To configure it:
- Create a Visual Attribute in your form (Object Navigator → Visual Attributes → Create)
- Set a background color (e.g., a light blue) and foreground color for the highlighted row
- In your block properties, set Current Record Visual Attribute Group to the visual attribute you created
This gives users a clear visual indicator of where their cursor is in the grid.
Querying Records in a Multi-Row Block
The standard query behavior in Oracle Forms applies to multi-row blocks. Users press F7 to enter query mode, type a search value in any field, and press F8 to execute the query. The results populate the visible rows, and users can scroll to see more.
You can customize the WHERE clause dynamically using the DEFAULT_WHERE property or the SET_BLOCK_PROPERTY built-in:
-- Restrict the multi-row block to show only active records
SET_BLOCK_PROPERTY('ORDER_LINES', DEFAULT_WHERE, 'status = ''ACTIVE''');
EXECUTE_QUERY;
Inserting and Deleting Rows
In a multi-row block, users can insert a new row by pressing the Insert Record key (usually the Down Arrow when on the last row, or a toolbar button). The new row appears as a blank row in the grid.
To delete a row, users navigate to it and press the delete record key. Oracle Forms marks the record for deletion but does not remove it from the database until the user commits (CTRL+S or a Save button).
You can control this behavior programmatically:
-- Check if the current record is marked for deletion
IF GET_RECORD_PROPERTY(SYSTEM.TRIGGER_RECORD, 'ORDER_LINES', STATUS) = 'DELETED' THEN
-- Perform pre-delete validation
NULL;
END IF;
Common Issues and Solutions
Problem: All rows look identical — no highlighting on current row
Solution: Set the Current Record Visual Attribute in block properties.
Problem: Scrollbar not appearing
Solution: Verify Show Scroll Bar is set to Yes in block properties and that the scrollbar object on the canvas has enough height to cover the displayed rows.
Problem: Block only shows 1 row despite Records Displayed = 10
Solution: Check that items in the block are positioned within the correct canvas coordinates. If items are stacked on top of each other, the block may not expand correctly.
Problem: Performance is slow with large result sets
Solution: Reduce Query Array Size to match Records Displayed, and add an index on the column used in WHERE clauses. Also consider adding a search parameter block above the multi-row block.
Multi-Row Blocks in Master-Detail Forms
The most common use of multi-row blocks is as the detail block in a master-detail relationship. For example:
- Master block: ORDER (single record view — one order at a time)
- Detail block: ORDER_LINES (multi-row view — all line items for that order)
Oracle Forms automatically creates the master-detail relationship using a Relation object, which handles the query coordination between blocks. When a user queries or navigates to a new master record, the detail block automatically refreshes to show only the related records.
Summary
Multi-row blocks are a core Oracle Forms feature that every developer needs to master. They transform simple single-record screens into powerful grid-based interfaces that let users work with data efficiently.
The keys are getting the layout wizard settings right (tabular layout, correct Records Displayed count, scrollbar enabled), setting the current record visual attribute for clarity, and configuring the block properties for the right balance of usability and performance.
Got questions about a specific multi-row block setup you are working on? Share it in the comments.