Oracle Forms Developer

:
Build Internet Applications I
Volume 2 • Instructor Guide
.......................................................................................

40033GC10
Production 1.0
March 2000
M011344

Author

Copyright  Oracle Corporation, 2000. All rights reserved.

Ellen Gravina

David Ball

This documentation contains proprietary information of Oracle Corporation. It is
provided under a license agreement containing restrictions on use and disclosure
and is also protected by copyright law. Reverse engineering of the software is
prohibited. If this documentation is delivered to a U.S. Government Agency of the
Department of Defense, then it is delivered with Restricted Rights and the
following legend is applicable:

Soley Celik

Restricted Rights Legend

Kathy Cunningham

Use, duplication or disclosure by the Government is subject to restrictions for
commercial computer software and shall be deemed to be Restricted Rights
software under Federal law, as set forth in subparagraph (c) (1) (ii) of DFARS
252.227-7013, Rights in Technical Data and Computer Software (October 1988).

Technical Contributors
and Reviewers

Ken Goetz
Andrey Ivkin
Kenji Makita
Jayne Marlow
Ian Purvis
Bryan Roberts
Rie Saitoh
Raza Siddiqui
Kajornsak
Sungchareon
Ted Witiuk
Publisher

Nita Brozowski

This material or any portion of it may not be copied in any form or by any means
without the express prior written permission of Oracle Corporation. Any other
copying is a violation of copyright law and may result in civil and/or criminal
penalties.
If this documentation is delivered to a U.S. Government Agency not within the
Department of Defense, then it is delivered with “Restricted Rights,” as defined in
FAR 52.227-14, Rights in Data-General, including Alternate III (June 1987).
The information in this document is subject to change without notice. If you find
any problems in the documentation, please report them in writing to Education
Products, Oracle Corporation, 500 Oracle Parkway, Box SB-6, Redwood Shores,
CA 94065. Oracle Corporation does not warrant that this document is error-free.
Oracle is a registered trademark and Oracle Forms Developer, Oracle Forms
Server, Oracle Reports Developer, Oracle Reports Server, and PL/SQL are
trademarks or registered trademarks of Oracle Corporation.
All other products or company names are used for identification purposes only
and may be trademarks of their respective owners.

Contents
.....................................................................................................................................................

Contents
Preface
Profile xvii
Related Publications xviii
Typographic Conventions xix
Introduction
Overview I-3
Course Objectives I-5
Course Content I-7
Lesson 1: Introduction to Oracle Forms Developer and Oracle
Forms Server
Introduction 1-3
Internet Computing Solutions 1-5
What Is Oracle Forms Developer? 1-7
What Is Oracle Forms Server? 1-9
Forms Server Architecture 1-11
Oracle Forms Developer Key Features 1-13
Form Builder Components 1-15
Oracle Toolkit and Oracle Multimedia 1-19
Getting Started in the Oracle Forms Developer Interface 1-21
Navigating Around the Form Builder Main Menu 1-23
Customizing Your Oracle Forms Developer Session 1-25
Saving Tools Preferences 1-27
Oracle Developer Environment Variables 1-29
Environment Variables and Y2K Compliance 1-31
Invoking Online Help Facilities 1-33
Introducing the Course Application 1-35
Summary 1-39
Practice 1 Overview 1-41
Practice 1 1-42

.....................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
iii

Contents
.....................................................................................................................................................

Lesson 2: Running a Form Builder Application
Introduction 2-3
Application Deployment 2-5
Web Deployment: What You See at Run Time 2-7
Client-Server Environment: What You See at Run Time
Identifying the Data Elements 2-13
Navigating a Form Builder Application 2-15
Modes of Operation 2-19
Retrieving Data 2-23
Performing a Restricted Query 2-25
Using the Query/Where Dialog Box 2-27
Inserting, Updating, and Deleting Records 2-31
Making Inserts, Updates, and Deletes Permanent 2-33
Displaying Errors 2-35
Summary 2-37
Practice 2 Overview 2-39
Practice 2 2-40

2-9

Lesson 3: Working in the Form Builder Environment
Introduction 3-3
What Is Form Builder? 3-5
Form Builder Executables 3-7
Form Builder Module Types 3-9
Form Builder Components 3-11
Summary 3-23
Lesson 4: Creating a Basic Form Module
Introduction 4-3
Creating a New Form Module 4-5
Creating a New Data Block 4-11
Modifying the Layout 4-23
Template Forms 4-25
Saving, Compiling, and Running a Form Module
Practice 4-1 Overview 4-35

4-27

.....................................................................................................................................................
iv
Oracle Forms Developer: Build Internet Applications I

Contents
.....................................................................................................................................................

Creating Data Blocks with Relationships 4-37
Creating a Relation Manually 4-43
Modifying a Relation 4-45
Running a Master-Detail Form Module 4-49
Summary 4-51
Practice 4-2 Overview 4-53
Practice 4-1 4-54
Practice 4-2 4-55
Lesson 5: Working with Data Blocks and Frames
Introduction 5-3
Managing Object Properties 5-5
Controlling the Behavior of Data Blocks 5-15
Controlling the Appearance of Data Blocks 5-21
Controlling Frame Properties 5-25
More About Object Properties 5-27
Creating Control Blocks 5-33
Deleting Data Blocks 5-35
Summary 5-37
Practice 5 Overview 5-39
Practice 5 5-40
Lesson 6: Working with Text Items
Introduction 6-3
What Is a Text Item? 6-5
Creating a Text Item 6-7
Modifying the Appearance of a Text Item 6-9
Associating Text with an Item Prompt 6-15
Controlling the Data of a Text Item 6-17
Altering the Navigational Behavior of a Text Item 6-23
Enhancing the Relationship Between Text Item and Database 6-25
Adding Functionality to a Text Item 6-27
Including Helpful Messages 6-33

.....................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
v

Contents
.....................................................................................................................................................

Summary 6-35
Practice 6 Overview 6-37
Practice 6 6-38
Lesson 7: Creating LOVs and Editors
Introduction 7-3
What Are LOVs and Editors? 7-5
Defining an LOV 7-9
Creating an LOV by Using the LOV Wizard
Defining an Editor 7-21
Summary 7-25
Practice 7 Overview 7-27
Practice 7 7-28

7-11

Lesson 8: Creating Additional Input Items
Introduction 8-3
What Are Input Items? 8-5
Creating a Check Box 8-7
Creating a List Item 8-15
Creating a Radio Group 8-23
Summary 8-31
Practice 8 Overview 8-33
Practice 8 8-34
Lesson 9: Creating Noninput Items
Introduction 9-3
What Are Noninput Items? 9-5
Creating a Display Item 9-7
Creating an Image Item 9-11
Creating a Sound Item 9-19
Creating a Push Button 9-25
Creating a Calculated Item 9-31
Creating a Hierarchical Tree Item 9-39

.....................................................................................................................................................
vi
Oracle Forms Developer: Build Internet Applications I

Contents
.....................................................................................................................................................

Summary 9-41
Practice 9 Overview 9-43
Practice 9 9-44
Lesson 10: Creating Windows and Content Canvases
Introduction 10-3
Windows and Content Canvases 10-5
Displaying a Form Module in Multiple Windows 10-9
Displaying a Form Module on Multiple Layouts 10-15
Summary 10-19
Practice 10 Overview 10-21
Practice 10 10-22
Lesson 11: Working with Other Canvases
Introduction 11-3
Canvases Overview 11-5
Creating a Stacked Canvas 11-7
Creating a Toolbar 11-13
Creating a Tab Canvas 11-17
Summary 11-25
Practice 11 Overview 11-27
Practice 11 11-28
Lesson 12: Introduction to Triggers
Introduction 12-3
What Is a Trigger? 12-5
Trigger Components 12-7
Summary 12-15
Lesson 13: Producing Triggers
Introduction 13-3
Defining Triggers in Form Builder 13-5
PL/SQL Editor Features 13-9
Database Trigger Editor 13-11
Writing the Trigger Code 13-13

.....................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
vii

Contents
.....................................................................................................................................................

Adding Functionality Using Built-in Subprograms
Using Triggers 13-27
Practice 13 Overview 13-32
Practice 13 13-33

13-19

Lesson 14: Debugging Triggers
Introduction 14-3
Debugging Triggers 14-5
Summary 14-27
Practice 14 Overview 14-29
Practice 14 14-30
Lesson 15: Adding Functionality to Items
Introduction 15-3
Item Interaction Triggers 15-5
Defining Functionality for Input Items 15-9
Defining Functionality for Noninput Items 15-13
Summary 15-27
Practice 15 Overview 15-29
Practice 15 15-30
Lesson 16: Runform Messages and Alerts
Introduction 16-3
Run-time Messages and Alerts Overview 16-5
Built-ins and Handling Errors 16-7
Errors and Built-ins 16-9
Controlling System Messages 16-11
The FORM_TRIGGER_FAILURE Exception 16-15
Triggers for Intercepting System Messages 16-17
Creating and Controlling Alerts 16-21
Summary 16-31
Practice 16 Overview 16-33
Practice 16 16-34

.....................................................................................................................................................
viii
Oracle Forms Developer: Build Internet Applications I

Contents
.....................................................................................................................................................

Lesson 17: Query Triggers
Introduction 17-3
Query Triggers 17-5
SELECT Statements Issued During Query Processing
WHERE and ORDER BY Clauses 17-9
Writing Query Triggers 17-11
Query Array Processing 17-15
Coding Triggers for Enter Query Mode 17-17
Overriding Default Query Processing 17-21
Obtaining Query Information at Run Time 17-25
Summary 17-29
Practice 17 Overview 17-31
Practice 17 17-32

17-7

Lesson 18: Validation
Introduction 18-3
Validation Process 18-5
Using Object Properties to Control Validation 18-7
Controlling Validation by Using Triggers 18-11
Validating User Input 18-13
Tracking Validation Status 18-15
Built-ins for Validation 18-17
Summary 18-19
Practice 18 Overview 18-21
Practice 18 18-22
Lesson 19: Navigation
Introduction 19-3
About Navigation 19-5
Controlling Navigation 19-7
Understanding Internal Navigation 19-11
Navigation Triggers 19-13
Using the When-New-“object”-Instance Triggers
Using the Pre- and Post-Triggers 19-17

19-15

.....................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
ix

Contents
.....................................................................................................................................................

The Navigation Trap 19-19
Navigation in Triggers 19-21
Summary 19-23
Practice 19 Overview 19-25
Practice 19 19-26
Lesson 20: Transaction Processing
Introduction 20-3
Transaction Processing 20-5
The Commit Sequence of Events 20-9
Characteristics of Commit Triggers 20-11
Common Uses for Commit Triggers 20-13
DML Statements Issued During Commit Processing 20-25
Overriding Default Transaction Processing 20-27
Running Against Data Sources Other than Oracle 20-31
Getting and Setting the Commit Status 20-33
Array Processing 20-39
Summary 20-43
Practice 20 Overview 20-45
Practice 20 20-46
Lesson 21: Writing Flexible Code
Introduction 21-3
What Is Flexible Code? 21-5
Using System Variables for Flexible Coding 21-7
Using Built-in Subprograms for Flexible Coding 21-11
Referencing Objects by Internal ID 21-15
Referencing Items Indirectly 21-23
Summary 21-27
Practice 21 Overview 21-29
Practice 21 21-30

.....................................................................................................................................................
x
Oracle Forms Developer: Build Internet Applications I

............................................................... Oracle Forms Developer: Build Internet Applications I xi ................................................................................................................................ Lesson 22: Sharing Objects and Code Introduction 22-3 Reusable Objects and Code Overview 22-5 Property Class 22-7 Creating a Property Class 22-9 Inheriting a Property Class 22-11 Creating an Object Group 22-13 Copying and Subclassing Objects and Code 22-17 What Is an Object Library? 22-23 Working with Object Libraries 22-25 What Is a SmartClass? 22-27 Reusing PL/SQL 22-29 PL/SQL Libraries 22-31 Working with PL/SQL Libraries 22-33 Summary 22-37 Practice 22 Overview 22-39 Practice 22 22-40 Lesson 23: Introducing Multiple Form Applications Introduction 23-3 Multiple Form Applications 23-5 How to Start Another Form Module 23-7 Defining Multiple Form Functionality 23-9 Summary 23-21 Practice 23 Overview 23-23 Practice 23 23-24 Appendix A: Practice Solutions Practice 1 Solutions A-2 Practice 2 Solutions A-5 Practice 4-1 Solutions A-8 Practice 4-2 Solutions A-10 Practice 5 Solutions A-13 Practice 6 Solutions A-16 ........................................................................................................Contents ....

................................................................................................................................................................................................................................................................. xii Oracle Forms Developer: Build Internet Applications I ........ Practice 7 Solutions Practice 8 Solutions Practice 9 Solutions Practice 10 Solutions Practice 11 Solutions Practice 13 Solutions Practice 14 Solutions Practice 15 Solutions Practice 16 Solutions Practice 17 Solutions Practice 18 Solutions Practice 19 Solutions Practice 20 Solutions Practice 21 Solutions Practice 22 Solutions Practice 23 Solutions A-22 A-25 A-27 A-32 A-33 A-41 A-43 A-44 A-46 A-48 A-50 A-52 A-54 A-58 A-60 A-63 Appendix B: Table Descriptions and Data Summit Sporting Goods Database Diagram B-2 S_CUSTOMER Description B-3 S_CUSTOMER Data B-4 S_DEPT Description and Data B-8 S_EMP Description B-9 S_EMP Data B-10 S_IMAGE Description and Data B-13 S_INVENTORY Description and Data B-14 S_ITEM Description B-21 S_ITEM Data B-22 S_ORD Description and Data B-24 S_PRODUCT Description B-25 S_PRODUCT Data B-26 ...............................Contents ...

............ Tables B-32 Appendix C: Oracle Rdb Overview What Is Oracle Rdb? C-2 Other Information C-4 Appendix D: Locking in Form Builder Locking D-5 Default Locking in Forms D-7 Locking in Triggers D-13 Summary D-19 Appendix E: Oracle8 Object Features Overview E-3 Oracle8 Datatypes E-5 Creating Oracle8 Objects E-11 Referencing Objects E-19 Displaying Oracle8 Objects in the Object Navigator E-21 Summary E-29 Appendix F: Using the Layout Editor Overview F-3 Why Use the Layout Editor? F-5 How to Access the Layout Editor F-7 Components of the Layout Editor F-9 Creating and Modifying Objects in the Layout Formatting Objects in the Layout F-19 Coloring Objects and Text F-21 Importing Images and Drawings F-25 Summary F-27 F-11 ................................................................................... S_REGION Description and Data B-30 S_TITLE Description and Data B-31 Oracle8 Objects: Types........................Contents ............................................................................... Oracle Forms Developer: Build Internet Applications I xiii ......................................................................................................

..................................................Contents ............................................................................................. xiv Oracle Forms Developer: Build Internet Applications I .............................. Appendix G: Introduction to Query Builder What Is Query Builder? G-3 The Query Builder Window G-7 Building a New Query G-9 Datasource Components G-11 Refining a Query G-13 Viewing and Saving Queries G-17 Including Additional Tables G-19 Relationships G-23 Selecting Rows with Conditions G-29 Operators G-31 Entering Multiple Conditions G-33 Changing Conditions G-35 Defining Columns Using an Expression G-37 Defining Columns Using a Function G-39 ..............................................................................................................................

... Adding Functionality to Items .......15 .......................

............................................................................................................................................. you should be able to do the following: • Supplement the functionality of input items by using triggers and built-ins • Supplement the functionality of noninput items by using triggers and built-ins Copyright  Oracle Corporation.................................. 15-2 Oracle Forms Developer: Build Internet Applications I ............................................................................... All rights reserved. Objectives After completing this lesson................................Lesson 15: Adding Functionality to Items .......... 2000... Schedule Topic Lecture Practice Total Timing 40 minutes 40 minutes 80 minutes .....

..............Introduction ...... ..................................... you will learn how to use triggers to provide additional functionality to GUI items in form applications........................................ Oracle Forms Developer: Build Internet Applications I 15-3 .................................................................................................................................................... Introduction Overview In this lesson..........................................................

................................................ 15-4 Oracle Forms Developer: Build Internet Applications I ...................... Instructor Note The When-Image-Pressed trigger fires when the user clicks the image........ When-Mouse-Click and When-Mouse-Doubleclick........................................ In this case......Lesson 15: Adding Functionality to Items ................. when the mouse is used by the user.. ............................. may also exist within the scope of the objects discussed here..................... 2000... the mouse-event triggers fire after the item interaction trigger.... Item Interaction Triggers When-Button-Pressed When-Checkbox-Changed When-Radio-Changed When-Image-Pressed When-Image-Activated When-List-Changed When-List-Activated When-Tree-Node-Activated When-Tree-Node-Expanded When-Tree-Node-Selected Copyright  Oracle Corporation....................................................................... The When-Image-Activated trigger fires when the user double-clicks the image. All rights reserved.. The mouse-event triggers......................................

....................................... Item Interaction Triggers There are several types of GUI items that the user can interact with by using the mouse or by pressing a function key........................ Oracle Forms Developer: Build Internet Applications I 15-5 ............. by selecting a radio button.......................... a list....... by single-click or function key User selects different button. or a check box • Conveniently displaying an image when the user clicks an image item • Defining the functionality of a push-button (which has none until you define it) The following triggers fire due to user interaction with an item........ Most of these items have default functionality.................... in a radio group User single-clicks image item User double-clicks image item User changes value of a list item User double-clicks element in a T-list User double-clicks a node or presses [Enter] when a node is selected User expands or collapses a node User selects or deselects a node ...... For example.......................... For example: • Performing tests and appropriate actions as soon as the user clicks a radio button.............. as previously described.... You will often want to add triggers to provide customized functionality when these events occur...................Item Interaction Triggers .............. Trigger When-Button-Pressed When-Checkbox-Changed When-Radio-Changed When-Image-Pressed When-Image-Activated When-List-Changed When-List-Activated When-Tree-Node-Activated When-Tree-Node-Expanded When-Tree-Node-Selected Firing Event User single-clicks with mouse or uses function key to select User changes check box state........................... or deselects current button............................................ the user can change the value of the radio group item........... They can be defined at any scope............

................................................. 2000............. 15-6 Oracle Forms Developer: Build Internet Applications I ................... Coding Item Interaction Triggers • Valid commands: – SELECT statements – Standard PL/SQL constructs – All built-in subprograms • Use When-Validate-“object” to trap the operator during validation................. because this customer has a poor credit rating...................... . Run the customer.. Instructor Note • Use the orders.........Lesson 15: Adding Functionality to Items ....................................... All rights reserved.......................fmb file to show the When-Radio-Changed trigger on Payment_Type of the S_ORD block................................................... Copyright  Oracle Corporation........................fmb file to show the functionality of the trigger............................... Use Customer ID 214........ Explain the actions in the trigger code.... • We will discuss using SELECT statements in triggers in the lesson on query triggers.

. END IF....Payment_Type....... MESSAGE(’Warning-customer must pay cash’).. However. the trigger terminates and sends the Unhandled Exception message to the operator.... then the payment type is set to cash. Example of When-Radio-Changed When-Radio-Changed trigger on :S_ORD....... Oracle Forms Developer: Build Internet Applications I 15-7 ............’EXCELLENT’) THEN :S_ORD... which provide a wide variety of mechanisms..credit_rating%TYPE.............................. BEGIN IF :S_ORD..... ..................... Command Types in Item Interaction Triggers You can use standard SQL and PL/SQL statements in these triggers.......payment_type = ’CREDIT’ THEN SELECT credit_rating INTO v_credit_rating FROM S_CUSTOMER WHERE id = :S_ORD...... END..customer_id................... END IF... DECLARE v_credit_rating S_CUSTOMER...payment_type := ’CASH’.................................... IF v_credit_rating NOT IN(’GOOD’................... like the example above................................... If not..... Note: During an unhandled exception........... you will often want to add functionality to items by calling built-in subprograms.....Item Interaction Triggers .............. When the user selects credit as the payment type for an order............................... The item interaction triggers do not fire on navigation or validation events...... this trigger immediately confirms whether the customer has a good or excellent credit rating.........................

................... UPDATE_ALLOWED..... Interacting with Check Boxes When-Checkbox-Changed IF CHECKBOX_CHECKED(’S_ORD.....date_shipped’.............................. ELSE SET_ITEM_PROPERTY(’S_ORD...........Lesson 15: Adding Functionality to Items ................................................. END IF............ 2000............ PROPERTY_TRUE)........... 15-8 Oracle Forms Developer: Build Internet Applications I ....................................................... All rights reserved.......... PROPERTY_FALSE)..... UPDATE_ALLOWED...........order_filled’) THEN SET_ITEM_PROPERTY(’S_ORD...................................date_shipped’......... Copyright  Oracle Corporation................................ ...

.......... PROPERTY_TRUE )............................. Example This When-Checkbox-Changed trigger on the :S_ORD.order_filled’) THEN SET_ITEM_PROPERTY(’S_ORD..................................... Oracle Forms Developer: Build Internet Applications I 15-9 .... Defining Functionality for Input Items You have already seen an example of adding functionality to radio groups............ You may want to perform trigger actions based on this change.....date_shipped’................................. ELSE SET_ITEM_PROPERTY(’S_ORD...... If the check box is set to off.... we now look at adding functionality to other items that accept user input.................. then the Date_Shipped item is enabled...............................PROPERTY_FALSE )....................... Check Boxes When the user selects or clears a check box...Defining Functionality for Input Items .... END IF.................date_shipped’.......... the associated value for the state is set..............Order_Filled item prevents the Date_Shipped item from being updated if the user marks the order as filled (checked on).................... UPDATE_ALLOWED..................... Note that the CHECKBOX_CHECKED function enables you to test the state of a check box without needing to know the associated values for the item....... IF CHECKBOX_CHECKED(’S_ORD...... UPDATE_ALLOWED......

...................................................................... ........................................... 2000.........................Lesson 15: Adding Functionality to Items .......... All rights reserved............................................................. Instructor Note Using POPULATE_LIST and lists with record groups is covered in the course Oracle Forms Developer: Build Internet Applications II......................... 15-10 Oracle Forms Developer: Build Internet Applications I .............. Changing List Items at Run Time Excellent ADD_LIST_ELEMENT DELETE_LIST_ELEMENT Excellent Good Poor Index 1 2 3 Copyright  Oracle Corporation.........................................................

........................................................... • Add or remove individual list elements through the ADD_ LIST_ELEMENT and DELETE_LIST_ELEMENT built-ins.............Defining Functionality for Input Items ........ ................ List Items You can use the When-List-Changed trigger to trap user selection of a list value........’value’) DELETE_LIST_ELEMENT(’list_item_name’.................. respectively.......... you can also change the selectable elements in a list as follows: • Periodically update the list from a two-column record group....................... Oracle Forms Developer: Build Internet Applications I 15-11 .............index) Parameter Description Index A number identifying the element position in the list (top=1) Label The name of the element Value The new value for this element Note: You can eliminate the Null list element of a list by setting the required property to Yes.................. For Tlists.........................................index................. ADD_LIST_ELEMENT(’list_item_name’.............................. With Form Builder........... you can trap double-clicks with When-List-Activated...........................’label’.

............................................................................. ..................Lesson 15: Adding Functionality to Items .............................................. set the Keyboard Navigable and Mouse Navigate properties of the button to No.......... 2000................ All rights reserved............ Use SHOW_LOV with a single button for the whole form................................... Displaying LOVs from Buttons • Uses: – Convenient alternative for accessing LOVs – Can display independently of text items • Needs: – When-Button-Pressed trigger – LIST_VALUES or SHOW_LOV built-in Copyright  Oracle Corporation........................................................................... 15-12 Oracle Forms Developer: Build Internet Applications I . Instructor Note Use LIST_VALUES with one button for each item that has a LOV... In both cases...............

Defining Functionality for Noninput Items
......................................................................................................................................................

Defining Functionality for Noninput Items
Displaying LOVs from Buttons
If you have attached a LOV to a text item, then the user can invoke the LOV from the
text item by selecting Edit—>Display List or pressing the List Values key.
However, it is always useful if a button is available to display a LOV. The button has
two advantages:
• It is convenient alternative for accessing the LOV.
• It displays a LOV independently of a text item (using SHOW_LOV).
There are two built-ins that you can call to invoke a LOV from a trigger. These are
LIST_VALUES and SHOW_LOV.
LIST_VALUES Procedure
This built-in procedure invokes the LOV that is attached to the current text item in the
form. It has an optional argument, which may be set to RESTRICT, meaning that the
current value of the text item is used as the initial search string on the LOV. The
default for this argument is NO_RESTRICT.
SHOW_LOV Function
This built-in function, without arguments, invokes the LOV of the current item.
However, there are arguments that let you define which LOV is to be displayed, and
what the x and y coordinates are where its window should appear:
SHOW_LOV( ’lov_name’, x, y )
SHOW_LOV( lov_id, x, y )

Notice that either the LOV name (in quotes) or the LOV ID (without quotes) can be
supplied in the first argument.
Note: The lov_id is a PL/SQL variable where the internal ID of the object is stored.
Internal IDs are a more efficient way of identifying an object.

......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
15-13

Lesson
15: Adding Functionality to Items
......................................................................................................................................................

LOVs and Buttons
105
LOV button

Employee_Id

Employees (LOV)

When-Button-Pressed
IF
IF SHOW_LOV(’myLov’)
SHOW_LOV(’myLov’)
THEN...
THEN...

Name
Daryl
Jayne
Christian
Claudia
Sergei
Lisa
Pam

ID
101
102
103
104
105
106
107

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
15-14
Oracle Forms Developer: Build Internet Applications I

Defining Functionality for Noninput Items
......................................................................................................................................................

Using the SHOW_LOV Function
The SHOW_LOV function returns a Boolean value:
• TRUE indicates that the user selected a record from the LOV.
• FALSE indicates that the user dismissed the LOV without choosing a
record, or that the LOV returned 0 records from its Record Group.
Note
• You can use the FORM_SUCCESS function to differentiate between the
two causes of SHOW_LOV returning FALSE.
Create the LOV button with a suitable label, such as “Pick,” and arrange it on the
canvas where the user intuitively associates it with the items that the LOV supports
(even though the button has no direct connection with text items). This is usually
adjacent to the main text item that the LOV returns a value to.
You can use the SHOW_LOV function to display a LOV that is not even attached
to a text item, providing that you identify the LOV in the first argument of the
function. When called from a button, this invokes the LOV to be independent of
cursor location.
• Switch off the button’s Mouse Navigate property of the button. When
using LIST_VALUES, the cursor needs to reside in the text item that is
attached to the LOV. With SHOW_LOV, this also maintains the cursor to
in its original location after the LOV is closed, wherever that may be.
Example
This When-Button-Pressed trigger on the Customer_Lov_Button invokes an LOV in a
PL/SQL loop, until the function returns TRUE. Because SHOW_LOV returns TRUE
when the user selects a record, the LOV redisplays until they do so.
LOOP
EXIT WHEN SHOW_LOV( ’customer_lov’ );
MESSAGE(’You must select a value from list’);
END LOOP;

......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
15-15

Lesson
15: Adding Functionality to Items
......................................................................................................................................................

Populating Image Items

^
Fetch on query

v
Database
WRITE_IMAGE_FILE

READ_IMAGE_FILE
Image file in the
file system
Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
15-16
Oracle Forms Developer: Build Internet Applications I

Defining Functionality for Noninput Items
......................................................................................................................................................

Image Items
Image items that have the Database Item property set to Yes automatically populate in
response to a query in the owning block (from a LONG RAW or BLOB column in the
base table).
Nonbase table image items, however, need to be populated by other means. For
example, from an image file in the file system: READ_IMAGE_FILE built-in
procedure.
You might decide to populate an image item from a button trigger, using WhenButton-Pressed, but there are two triggers that fire when the user interacts with an
image item directly:
• When-Image-Pressed (fires for a single click on image item)
• When-Image-Activated (fires for a double-click on image item)
READ_IMAGE_FILE Procedure
This built-in procedure lets you load an image file, in a variety of formats, into an
image item.
READ_IMAGE_FILE(’filename’,’filetype’,’item_name’);
Parameter

Description

filename

The image file name (Without a specified path, the default path is
assumed.)

filetype

The file type of the image (You can use ANY as a value, but it is recommended to set a specific file type for better performance. Refer to the online
Help system for file types.)

item_name

The name of the image item (a variable holding the Item_id is also valid for
this argument) (This parameter is optional.)

Note
• The filetype parameter is optional in READ_IMAGE_FILE. If you omit
filetype, you must explicitly identify the item_name parameter.
• The reverse procedure, WRITE_IMAGE_FILE, is also available. You
can use GET_FILE_NAME built-in to display the standard open file
dialog box where the user can select an existing file or specify a new file.

......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
15-17

Lesson
15: Adding Functionality to Items
......................................................................................................................................................

Loading the Right Image

READ_IMAGE_FILE(
’F_’||TO_CHAR(:S_ITEM.product_id)||’.BMP’,
’BMP’,
’S_ITEM.product_image’ );

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
15-18
Oracle Forms Developer: Build Internet Applications I

Defining Functionality for Noninput Items
......................................................................................................................................................

Example of Image Items
The following When-Image-Pressed trigger on the Product_Image item displays a
picture of the current product (in the ITEM block) when the user clicks the image item.
This example assumes that the related filenames have the format:
F_<product id>.BMP
READ_IMAGE_FILE(’F_’||TO_CHAR(:S_ITEM.product_id)||’.BMP’,
’BMP’,’S_ITEM.product_image’ );

Notice that as the first argument to this built-in is datatype CHAR, the concatenated
NUMBER item, product_id, must first be converted by using the TO_CHAR function.
Note: If you load an image into a base table image item by using
READ_IMAGE_FILE, then its contents will be committed to the database LONG
RAW or BLOB column when you save changes in the form. You can use this
technique to populate a table with images.
Other options are available for populating an image item, such as pasting an image
from the clipboard into an empty image item. Refer to the online Help for more
information.

......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
15-19

Lesson
15: Adding Functionality to Items
......................................................................................................................................................

Interacting with Sound Items

GET_ITEM_PROPERTY and SET_ITEM_PROPERTY:







SHOW_FAST_FORWARD_BUTTON
SHOW_PLAY_BUTTON
SHOW_RECORD_BUTTON
SHOW_REWIND_BUTTON
SHOW_SLIDER
SHOW_TIME_INDICATOR
SHOW_VOLUME_CONTROL

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
15-20
Oracle Forms Developer: Build Internet Applications I

Defining Functionality for Noninput Items
......................................................................................................................................................

Interacting with Sound Items
When you create a sound item, Form Builder automatically represents the item in the
layout with the sound item control.
You can hide or display or get information about each component of a sound item
control programmatically by using SET_ITEM_PROPERTY and
GET_ITEM_PROPERTY built-ins (however, you must always have either the Play or
Record button displayed for a sound item).
You can use the following properties with these two built-ins:
• SHOW_FAST_FORWARD_BUTTON
• SHOW_PLAY_BUTTON
• SHOW_RECORD_BUTTON
• SHOW_REWIND_BUTTON
• SHOW_SLIDER
• SHOW_TIME_INDICATOR
• SHOW_VOLUME_CONTROL
Use the PROPERTY_TRUE or PROPERTY_FALSE parameters with the
SET_ITEM_PROPERTY built-in. The GET_ITEM_PROPERTY built-in returns
TRUE or FALSE as data type VARCHAR2.

......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
15-21

Lesson
15: Adding Functionality to Items
......................................................................................................................................................

Populating Hierarchy Trees
CREATE_GROUP_FROM_QUERY
Database

Record Group

When-New-Form-Instance

-

Car

SET_TREE_PROPERTY

Ford
Volvo
VW
Toyota

Copyright  Oracle Corporation, 2000. All rights reserved.

Instructor Note
This example uses a record group to populate the tree. Developers can also use a query
to populate a hierarchical tree. The example used in the following slides is contained
in the HTreeDemo.fmb file. The HTreeDemo2.fmb file contains a more complete
example, using the data stored in the tree nodes to display details about a specific
employee.

......................................................................................................................................................
15-22
Oracle Forms Developer: Build Internet Applications I

........ value)................. Note: All built-ins are located in the FTREE built-in package.......... Populating Hierarchical Trees The hierarchical tree displays data in the form of a standard navigator...... Ftree......... You can populate a hierarchical tree with values contained in a Record Group or Query Text................. SET_TREE_PROPERTY Procedure This built-in procedure can be used to change certain properties for the indicated hierarchical tree item It can also be used to populate the indicated hierarchical tree item from a record group..property............................... you can programmatically add... Ftree....................Set_Tree_Property(item_name... Oracle Forms Developer: Build Internet Applications I 15-23 .. property Specifies one of the following properties: RECORD_GROUP: Replaces the data set of the hierarchical tree with a record group and causes it to display QUERY_TEXT: Replaces the data set of the hierarchical tree with an SQL query and causes it to display ALLOW_EMPTY_BRANCHES: Possible values are PROPERTY_TRUE and PROPERTY_FALSE value Specifies the value appropriate to the property you are setting: PROPERTY_TRUE: The property is set to the TRUE state................ modify........ You can also use the property palette to populate the hierarchical tree................................. Parameter Description item_name Specifies the name of the object created at design time..................................... At run time........Defining Functionality for Noninput Items .............. The data type of the name is VARCHAR2..................... .................. or evaluate elements in a hierarchical tree............. remove.............. similar to the Object Navigator used in Oracle Forms Developer.. PROPERTY_FALSE: The property is set to the FALSE state.........

................................ 2000......................... 15-24 Oracle Forms Developer: Build Internet Applications I ..record_group..... v_ignore := populate_group(rg_emps).....set_tree_property(‘block4...... set_tree_property ftree............. rg_emps)........................... ‘select 1........ NULL.... to_char(id) ‘ || ‘from s_emp ‘ || ‘connect by prior id= manager_id ‘|| ‘start with title = ‘‘President’’’)................ level....... last_name................................tree5’................................................... All rights reserved.............. ftree. ....................Lesson 15: Adding Functionality to Items ........ Technical Note The columns in a record group or query used to populate a hierarchical tree are: • Initial state • Node tree depth • Label for the node • Icon for the node • Data Instructor Note Hierarchical tree items are covered in the course Oracle Forms Developer: Build Internet Applications II............ Displaying Hierarchy Trees WHEN-NEW-FORM-INSTANCE rg_emps := create_group_from_query(‘rg_emps’ create_group_from_query(‘rg_emps’.......... Copyright  Oracle Corporation....................

...... Then. rg_emps := Create_Group_From_Query('rg_emps'..... Ftree.... DECLARE htree v_ignore rg_emps ITEM............... to_char(empno) ’ || ' from emp ' || 'connect by prior empno = mgr ' || ’start with job = ’’PRESIDENT’’’).............................................................. SET_TREE_PROPERTY Procedure (continued) You can add data to a tree view by: • Populating a tree with values contained in a record group or query by using the POPULATE_TREE built-in • Adding data to a tree under a specific node by using the ADD_TREE_DATA built-in • Modifying elements in a tree at run time by using built-in subprograms • Adding or deleting nodes and the data elements under the nodes Example This code could be used in a WHEN-NEW-FORM-INSTANCE trigger to initially populate the hierarchical tree with data...... The example locates the hierarchical tree first................................ ’select 1............htree3'). ....... ename...................... BEGIN htree := Find_Item('tree_block.. a record group is created and the hierarchical tree is populated....... NUMBER........ Ftree..................... RECORDGROUP..........Set_Tree_Property(htree.... v_ignore := Populate_Group(rg_emps)......... rg_emps)........ Oracle Forms Developer: Build Internet Applications I 15-25 ....................................... level... NULL................ END.........Defining Functionality for Noninput Items .........RECORD_GROUP.....

.......... Summary • Item interaction triggers accept SELECT statements and other standard PL/SQL constructs....... image file reading............... 2000........................................................................................ Copyright  Oracle Corporation... .......... All rights reserved.......... LOV control......... and sound item control............. 15-26 Oracle Forms Developer: Build Internet Applications I .....................................................................Lesson 15: Adding Functionality to Items ............. list item control................ • You use built-ins for check boxes..................... hierarchical tree...........................

........................................... and so on.... • The item interaction triggers accept SELECT statements and other standard PL/SQL constructs.............Summary .... you learned to use triggers to provide functionality to the GUI items in form applications........................................ Oracle Forms Developer: Build Internet Applications I 15-27 ............. • There are built-ins for LOV control.. sound item control........................................... hierarchical tree.................................................................................. list item control......... ........................... image file reading...... Summary In this lesson........................

..... see Practice 15 in Appendix A... Note For solutions to this practice................................................. 15-28 Oracle Forms Developer: Build Internet Applications I ................................................ 2000... Practice 15 Overview This practice covers the following topics: • Writing a trigger to check whether the customer’s credit rating forces him to pay cash • Creating a toolbar button to display and hide product images Copyright  Oracle Corporation.................................................... All rights reserved.............” ............................................................Lesson 15: Adding Functionality to Items ..... “Practice Solutions.....................................................................

.............................................. ..... You also create some additional functionality for a radio group.................................................................................. Oracle Forms Developer: Build Internet Applications I 15-29 .................Practice 15 Overview ............ you add some triggers that enable interaction with buttons..................... Practice 15 Overview In this practice...... • Writing a trigger to check whether the customer’s credit rating forces him to pay cash • Creating a toolbar button to display and hide product images Instructor Note Be sure the students understand that the code they will import for practice #3 will only toggle the image item................................... The code to display an image in the image item will be implemented in a later practice..................................................................................

.image_description’. If the current value is True............... PROPERTY_TRUE)..... Deploy the form on the Web. ELSE SET_ITEM_PROPERTY(’S_ITEM.......... 15-30 Oracle Forms Developer: Build Internet Applications I ....txt file................’Image On’). .......................... Finally the label changes on the Image_Button to reflect its next toggle state............ PROPERTY_TRUE)......image_button’....VISIBLE)=’TRUE’ THEN SET_ITEM_PROPERTY(’S_ITEM................Lesson 15: Adding Functionality to Items ... PROPERTY_FALSE)..... ’Image Off’).......................... if the visible property is currently False.................. 4 Save and compile the form.............. allowing only those customers with a good or excellent credit rating to pay for orders on credit.... Set Label property to Image Off....Image_Button IF GET_ITEM_PROPERTY(’S_ITEM.. VISIBLE.... SET_ITEM_PROPERTY(’S_ITEM.....LABEL..........product_image’........ You can import the pr15_1.............. SET_ITEM_PROPERTY(’CONTROL........... Practice 15 1 In the ORDGXX form write a trigger that fires when the payment type changes.product_image’. END IF..... the visible property toggles to True for both the Product Image item and the Image Description item.....image_button’..image_description’.. 2 In the CONTROL block...txt into a trigger that fires when the Image_Button is clicked................... VISIBLE. When-Button-Pressed on CONTROL.LABEL. However...... the visible property toggles to False for both the Product Image item and the Image Description item.. VISIBLE....... SET_ITEM_PROPERTY(’S_ITEM............... PROPERTY_FALSE).... SET_ITEM_PROPERTY(’CONTROL. 3 Import the file pr15_3.. VISIBLE. The file contains code that determines the current value of the visible property of the Product Image item.......product_image’.............. create a new button called Image_Button and position it on the Toolbar.

.................16 ....... Runform Messages and Alerts .........

...... 2000............................................. All rights reserved................................. 16-2 Oracle Forms Developer: Build Internet Applications I ....................Lesson 16: Runform Messages and Alerts .................... Schedule Topic Lecture Practice Total Timing 60 minutes 20 minutes 80 minutes ........................................................................................ Objectives After completing this lesson.................................................................................. you should be able to do the following: • • • Describe the default messaging • • Control system messages Handle errors using built-in subprograms Identify the different types of Form Builder messages Create and control alerts Copyright  Oracle Corporation...........

.................................................................................. Oracle Forms Developer: Build Internet Applications I 16-3 ............................................................. and if desired.. Introduction Overview This lesson shows you how to intercept system messages.... and how to build customized alerts for communicating with users......................................................................... You will also learn how to handle errors by using built-in subprograms..................... ............... replace them with ones that are more suitable for your application....................................Introduction ............

........Lesson 16: Runform Messages and Alerts .................................................................................................................................................. 2000.................................. 16-4 Oracle Forms Developer: Build Internet Applications I ......................................................... All rights reserved....................... ............................ Communicating with the Operator Alerts System Application Messages Informative Error Working Application Copyright  Oracle Corporation........

................................................ or gives context-sensitive information........... • Application alert: These are alerts that you design as part of your application. depending on the nature of the application........................... you may want to either suppress or modify some of these messages..... This type of message can be suppressed by setting the system variable SUPPRESS_WORKING to True..............Run-time Messages and Alerts Overview .. Oracle Forms Developer: Build Internet Applications I 16-5 ....... You can also build messages and alerts into your application: • Application message: These are messages that you build into your application by using the MESSAGE built-in.. You can suppress message line errors with an On-Error trigger............... • Error message: This informs the user of an error that prevents the current action. This is displayed as a modal window............ The default display is on the message line.. • System alert: Alerts give information to the operator that require either an acknowledgment or an answer to a question before processing can continue...................................... Form Builder can communicate with the user in the following ways: • Informative message: A message tells the user the current state of processing... The default display is on the message line........... • Working message: This tells the operator that the form is currently processing (for example: Working........... This is shown on the message line.. ......... Run-time Messages and Alerts Overview Form Builder displays messages at run time to inform the operator of events that occur in the session. the current message also displays as an alert.... The default display is on the message line.........).............................................. When more than one message is waiting to show on the message line.. You can suppress its appearance with an On-Message trigger..... As the designer...... and issue to the operator for a response by using the SHOW_ALERT built-in................................

.....Lesson 16: Runform Messages and Alerts ................... 16-6 Oracle Forms Developer: Build Internet Applications I .... ................... All rights reserved..................................................... Detecting Run Time Errors • FORM_SUCCESS – TRUE: Action successful – FALSE: Error/Fatal error occurred • FORM_FAILURE – TRUE: A nonfatal error occurred – FALSE: No error/No fatal error • FORM_FATAL – TRUE: A fatal error occurred – FALSE: No error/No nonfatal error Copyright  Oracle Corporation........................................................................................................................................................................ 2000....................................

.. and performs a query there. it does not directly cause an exception in the calling trigger or program unit.................................................... This means that subsequent code continues after a built-in fails.................. or a fatal error TRUE: A fatal error occurred FALSE: Either no error... EXECUTE_QUERY........ Example A button in the CONTROL block called Stock_Button is situated on the Toolbar canvas of the ORDERS form............ .. or a nonfatal error Note: These built-in functions return success or failure of the latest action in the form.......... the EXECUTE_QUERY procedure.................. this When-Button-Pressed trigger navigates to the S_INVENTORY block. can cause a Pre-Query trigger to fire..... unless you take action to detect a failure........... Built-in Functions for Detecting Success and Failure The Form Builder supplies some functions that indicate whether the latest action in the form was successful: Built-in Function FORM_SUCCESS FORM_FAILURE FORM_FATAL Description of Returned Value TRUE: Action successful FALSE: Error or fatal error occurred TRUE: A nonfatal error occurred FALSE: Either no error................. then the EXECUTE_QUERY procedure still executes................................ For example..... The failing action may occur in a trigger that fired as a result of a built-in from the first trigger..... and attempts a query in the wrong block.................. or because it is nonenterable.................. which may itself fail.................. Oracle Forms Developer: Build Internet Applications I 16-7 .. GO_BLOCK(’S_INVENTORY’).. If the GO_BLOCK built-in procedure fails because the S_INVENTORY block does not exist......... Built-ins and Handling Errors When a built-in subprogram fails............................. When clicked................Built-ins and Handling Errors .........

.................................... Errors and Built-ins • • Built-in failure does not cause an exception... 2000............................... 16-8 Oracle Forms Developer: Build Internet Applications I .............................................. .................. ERROR_TYPE – MESSAGE _CODE................ Test built-in success with FORM_SUCCESS function.......... ERROR_TEXT............ MESSAGE _TEXT............................ MESSAGE _TYPE Copyright  Oracle Corporation............................................. .... All rights reserved. • What went wrong? – ERROR_CODE...... IF FORM_SUCCESS THEN ....Lesson 16: Runform Messages and Alerts ....................................... ..............

.. because this returns FALSE if either a fatal or a nonfatal error occurs.................... you may need to identify it to take a specific action...... ELSE MESSAGE(’An error occurred while navigating to Stock’)......................................................... END IF.... Note: Look at the program unit CHECK_PACKAGE_FAILURE...........Errors and Built-ins .. This procedure may be called to fail a trigger if the last action was unsuccessful.... Three more built-in functions provide this information: Built-in Function ERROR_CODE ERROR_TEXT ERROR_TYPE Description of Returned Value Error number (datatype NUMBER) Error description (datatype CHAR) FRM=Form Builder error..... You can then code the trigger to take appropriate action............................................ ORA=Oracle error (datatype CHAR) We will look at these built-ins again when we discuss controlling messages..................... Triggers fail only if there is an unhandled exception or you raise the FORM_TRIGGER_FAILURE exception to fail the trigger in a controlled manner.. which is written for you as part of Relation management. GO_BLOCK(’S_INVENTORY’).. Oracle Forms Developer: Build Internet Applications I 16-9 ............ the FORM_SUCCESS function is used in a condition to decide if the query should be performed.. when you build master-detail blocks...... .... Example of FORM_SUCCESS Here is the same trigger again....... This time............ IF FORM_SUCCESS THEN EXECUTE_QUERY........................ Errors and Built-ins It is usually most practical to use FORM_SUCCESS.......... Built-in Functions to Determine the Error When you detect an error............................................. depending on the success of the GO_BLOCK action..................

........................................................... 2000......MESSAGE_LEVEL Copyright  Oracle Corporation................................ 16-10 Oracle Forms Developer: Build Internet Applications I ..................................................................... ....................................................................................... Message Severity Levels 0 All (default) 5 10 15 20 More critical 25 >25 Define by: :SYSTEM......... All rights reserved...Lesson 16: Runform Messages and Alerts ........................................

...... You do this by assigning a value to the system variable MESSAGE_LEVEL..................... the higher the numbers................. There are six levels that you can affect............................. Severity Level 0 5 10 15 20 25 >25 Description All messages Reaffirms an obvious condition User has made a procedural mistake User attempting action for which the form is not designed Cannot continue intended action due to a trigger problem or some other outstanding condition A condition that could result in the form performing incorrectly Messages that the designer cannot suppress In a trigger... ........ Oracle Forms Developer: Build Internet Applications I 16-11 .... based on their severity level.......................................................................................... This means that messages of all severities are displayed.......... Controlling System Messages Suppressing Messages According to Their Severity You can prevent system messages from being issued.......................................................... Form Builder then only issues messages that are above the severity level defined in this variable........Controlling System Messages ............ you can specify that only messages above a specified severity level are to be issued by the form.......... The default value for MESSAGE_LEVEL (at form startup) is 0............. Form Builder classifies every message with a severity level that indicates how critical or trivial the information is.......... the more critical the message..............

...................................SUPPRESS_WORKING := := ’TRUE’. ’TRUE’........SUPPRESS_WORKING :SYSTEM.......... .... IF NOT FORM_SUCCESS THEN MESSAGE(’Already at the first Order’).................................... All rights reserved...... 2000.............MESSAGE_LEVEL := ’5’.....MESSAGE_LEVEL := ’0’......... UP....... END IF.. :SYSTEM. 16-12 Oracle Forms Developer: Build Internet Applications I ......................................................................Lesson 16: Runform Messages and Alerts .... Suppressing Messages :SYSTEM............................................................................. :SYSTEM... Copyright  Oracle Corporation........................

............. :SYSTEM..... Note: You can set these system variables as soon as the form starts up..... Example of Suppressing Messages The following When-Button-Pressed trigger moves up one record................. This is a severity level 5 message............... using the built-in procedure UP............................. END IF.. Suppressing Working Messages Working messages are displayed when the Form Builder is busy processing an action.......... ........... :SYSTEM.. The trigger resets the message level to normal (0) afterwards.. IF NOT FORM_SUCCESS THEN MESSAGE(’Already at the first Order’)............................... However the trigger suppresses this............Controlling System Messages .......... UP........ Oracle Forms Developer: Build Internet Applications I 16-13 ...................................... For example.... if required. while querying you receive: Working...... and outputs its own application message instead... message.............. :SYSTEM.MESSAGE_LEVEL := ’0’. If the cursor is already on the first record... the built-in fails and the following message usually displays: FRM-40100: At first record.... by performing the assignments in a When-New-Form-Instance trigger.............. You can suppress this message by setting the system variable SUPPRESS_WORKING to True...................SUPPRESS_WORKING := ’TRUE’..............................MESSAGE_LEVEL := ’5’..................

...................................................... --EXCEPTION EXCEPTION --WHEN WHEN <exception> <exception> THEN THEN RAISE RAISE form_trigger_failure................ All rights reserved.... form_trigger_failure...................... FORM_TRIGGER_FAILURE BEGIN BEGIN --RAISE RAISE form_trigger_failure....................Lesson 16: Runform Messages and Alerts ............... Instructor Note The broken line in the diagram represents possible route into the EXCEPTION section if the designer has coded an exception handler for FORM_TRIGGER_FAILURE or OTHERS........ ....................... 16-14 Oracle Forms Developer: Build Internet Applications I .................................................... 2000.... form_trigger_failure.. Fail trigger Copyright  Oracle Corporation................................................... --END.......................................

....customer_id............... beyond the visible trigger text that you write............... You can raise this exception: • In the executable part of a trigger............ :S_ORD........................ to skip remaining actions and fail the trigger • In an exception handler.................... to fail the trigger after your own exception handling actions have been obeyed In either case.. This means that you can fail the trigger in a controlled manner......................................... The FORM_TRIGGER_FAILURE Exception Triggers fail only when one of the following occurs: • During an Unhandled Exception • When you request Form Builder to fail the trigger by raising the built-in exception FORM_TRIGGER_FAILURE This exception is defined and handled by Form Builder.......... Form Builder has its own exception handler for FORM_TRIGGER_ FAILURE.customer_name.........The FORM_TRIGGER_FAILURE Exception ......................... phone INTO :S_ORD........................ EXCEPTION WHEN no_data_found THEN MESSAGE(’Customer with this ID not found’).............customer_phone FROM S_CUSTOMER WHERE id = :S_ORD.. which fails the trigger but does not cause an unhandled exception... Example This example adds an action to the trigger exception handler....................... Oracle Forms Developer: Build Internet Applications I 16-15 ....................... RAISE form_trigger_failure............. and therefore trapping the user in the Customer_ID item: SELECT name................ .................... raising an exception to fail the trigger when the message is sent....

.. ... 2000............... and to customize error messages • On-Message: – Fires when an informative system message is issued – Is used to suppress or customize specific messages Copyright  Oracle Corporation.......Lesson 16: Runform Messages and Alerts ............................................................................................................................................................................................. All rights reserved.................................... Instructor Note Remind students that On triggers fire in place of the usual processing........ Error Triggers • On-Error: – Fires when a system error message is issued – Is used to trap Form Builder and Oracle Server errors.......................... 16-16 Oracle Forms Developer: Build Internet Applications I ....................

......... RAISE FORM_TRIGGER_FAILURE................. On-Error Trigger Use this trigger to: • Detect Form Builder and Oracle Server errors........ but reconstructs the standard system message for all other errors..................... so that no message is seen by the operator unless you issue one from the trigger itself... However.......Triggers for Intercepting System Messages ....... ................ END IF... This trigger can perform corrective actions based on the error that occurred.... IF ERROR_CODE = 40202 THEN MESSAGE(’You must fill in this field for an Order’).............. These triggers are: • On-Error: Fires on display of a system error message • On-Message: Fires on display of an informative system message These triggers replace the display of a message......... if you define one or both of these triggers at form level.................... Remember that you can use the built-in functions ERROR_CODE.. For example. ELSE MESSAGE(ERROR_TYPE || ’-’ || TO_CHAR(ERROR_CODE) || ’: ’ || ERROR_TEXT)....................... Oracle Forms Developer: Build Internet Applications I 16-17 ....................................... and ERROR_TYPE to identify the details of the error.. all messages that cause them to fire will be intercepted regardless of which object in the current form causes the error or message. Triggers for Intercepting System Messages By writing triggers that fire on message events you can intercept system messages before they are displayed on the screen.... • Replace the default error message with a customized message for this application............................ You can define these triggers at any level........... Example of an On-Error Trigger This On-Error trigger sends a customized message for error 40202 (field must be entered)................................... ERROR_ TEXT.......................... and possibly use this information in your own message...... an On-Error trigger at item level only intercepts error messages that occur while control is in that item.......

........................................................................................... 16-18 Oracle Forms Developer: Build Internet Applications I ............................. ............................................................................. Handling Informative Messages • • On-Message trigger Built-in functions: – MESSAGE_CODE – MESSAGE_TEXT – MESSAGE_TYPE Copyright  Oracle Corporation................................ 2000.............................................. All rights reserved.Lesson 16: Runform Messages and Alerts ............................

......... On-Message Trigger Use this trigger to suppress informative messages.... You can handle messages in On-Message in a similar way to On-Error......... because this trigger fires due to informative messages... END IF.. then use MESSAGE_CODE in preference to MESSAGE_TEXT when checking a message... you will use different built-ins to determine the nature of the current message......... If your applications must be supported in more than one national language....... as appropriate...................................... Example of an On-Message Trigger This On-Message trigger modifies the “Query caused no records to be retrieved” message (40350)........................... However.............................................................. Oracle Forms Developer: Build Internet Applications I 16-19 ...............Triggers for Intercepting System Messages ........................... Built-in Function MESSAGE_CODE MESSAGE_TEXT MESSAGE_TYPE Description of Returned Value Number of informative message that would have displayed (datatype NUMBER) Text of informative message that would have displayed (datatype CHAR) FRM=Form Builder message ORA= Oracle server message NULL=No message issued yet in this session (datatype CHAR) Note: These functions return information about the most recent message that was issued............ ELSE MESSAGE(MESSAGE_TYPE || ’-’ || TO_CHAR(MESSAGE_CODE) || ’: ’|| MESSAGE_TEXT)...................... replacing them with customized application messages......................................................... IF MESSAGE_CODE = 40350 THEN MESSAGE(’No Orders found-check your search values’). ........

....................................... 16-20 Oracle Forms Developer: Build Internet Applications I ................ Alert Properties 1 2 3 4 5 6 Copyright  Oracle Corporation........................ .................... as in the Delete Record example that follows................. caution. You may want to define more than one button so that you can show the testing of user response.......Lesson 16: Runform Messages and Alerts .............................. note) 4 Button1 label 5 Button2 label 6 Button3 label Instructor Note Create an alert that you can display in your application during a later demonstration............ 2000...... Alert Example This is a generic example of an alert................................... showing all three icons and buttons that can be defined................................... 1 Title 2 Message 3 Alert style (stop................................................. All rights reserved....................

................... No........... • Ask the operator a question where up to three answers are appropriate (typically Yes............. Because they display in a modal window............................ and take action based on the operator’s returned response.................... Here are the properties that are specific to an alert.. Use alerts when you need to do the following: • Display a message that the operator cannot ignore...... Oracle Forms Developer: Build Internet Applications I 16-21 ...................... Alerts are therefore managed in two stages: • Create the alert at design-time.... You handle the display and responses to an alert by using built-in subprograms.. alerts provide an effective way of drawing attention and forcing the operator to answer the message before processing can continue..............) Button 1. and must acknowledge........ Creating and Controlling Alerts Alerts are an alternative method for communicating with the operator.................. Button3 Default Alert Button Message Description Name for this object Alert title Defines the symbol that accompanies message: Stop....... and then select Create....... alerts are created from the Object Navigator... or Cancel)....................Creating and Controlling Alerts ....... 2 Define the properties of the alert in the Property Palette... and define its properties in the Property palette.......... • Activate the alert at run time by using built-ins.. or Button 3 Message that will appear in the alert (maximum 200 characters) ............. Button2.......... Property Name Title Alert Style Button1.. This is an abridged list. or Note Labels for each of the three possible buttons (Null indicates that the button is not required............................... How to Create an Alert Like other objects you create at design-time............... Button 2.... 1 Select the Alerts node in the Navigator...... Caution...................

............ the icons for the stop and note style alerts are different than they are in client-server................. 2000... 16-22 Oracle Forms Developer: Build Internet Applications I .......... Planning Alerts Yes/No questions Yes/No/Cancel questions Caution messages Informative messages Copyright  Oracle Corporation.................................................................... Instructor Note When a form is deployed to the Web and the LookAndFeel parameter is set to Oracle.......... ...........Lesson 16: Runform Messages and Alerts .............................................. All rights reserved.................................................................................................................................

.

...................................................................................................... .............................. 2000........................ Controlling Alerts SET_ALERT_PROPERTY SET_ALERT_BUTTON_PROPERTY Copyright  Oracle Corporation...................................................................................................................................Lesson 16: Runform Messages and Alerts ............... 16-24 Oracle Forms Developer: Build Internet Applications I . All rights reserved.

..... SET_ALERT_PROPERTY Procedure Use this built-in to change the message that is currently assigned to an alert. ALERT_BUTTON2..... Controlling Alerts at Run Time There are built-in subprograms to change an alert message.............................. and to display the alert....) Message The character string that defines the message (You can give a character expression instead of a simple quoted string...................Creating and Controlling Alerts .................. as defined in the Designer (You can alternatively specify an alert_id (unquoted) for this argument................... At form startup.......property..........) Button The number that specifies the alert button (Use ALERT_BUTTON1.........’message’) Parameter Description Alert_name The name of the alert...... button.. the default message (as defined in the Property palette) is initially assigned: SET_ALERT_PROPERTY(’alert_name’.................. to change alert button labels.................................. property... use LABEL Value The character string that defines the label ............... if required.) SET_ALERT_BUTTON_PROPERTY Procedure Use this built-in to change the label on one of the alert buttons: SET_ALERT_BUTTON_PROPERTY(’alert_name’................... ’value’) Parameter Description Alert_name The name of the alert................... ALERT_BUTTON3 constants........... as defined in the Designer (You can alternatively specify an alert_id (unquoted) for this argument......................) Property The property being set.....) Property The property being set (Use ALERT_MESSAGE_TEXT when defining a new message for the alert................ Oracle Forms Developer: Build Internet Applications I 16-25 ........... which returns the operator’s response to the calling trigger..............

....... SHOW_ALERT Function •IF •IF .................... 3 Show the underlying code in this form........ Demonstration Run the Show_Alert.............. The button number that you clicked appears in the text item...............fmb file that demonstrates creating a generic alert.. Instructor Note Write a trigger that displays your earlier alert........................... SHOW_ALERT(’del_Check’)=ALERT_BUTTON1 SHOW_ALERT(’del_Check’)=ALERT_BUTTON1 THEN THEN .................................................................................................................. ...... Alert_Button1 Alert_Button2 Alert_Button3 Copyright  Oracle Corporation.... 2 Click the Show the Alert button......................... 16-26 Oracle Forms Developer: Build Internet Applications I .............. and button labels to any value you want.......... All rights reserved.............. 2000......Lesson 16: Runform Messages and Alerts .... .......................... 1 Set title. message..

.......... and return the operator’s response to the calling trigger: selected_button := SHOW_ALERT(’alert_name’).... that indicates which of the three possible buttons the user pressed in response to the alert... END IF............................................................. as defined in the builder... .... If the operator selects Yes.................Creating and Controlling Alerts ................................................ SHOW_ALERT Function SHOW_ALERT is how you display an alert at run time.................. Example A trigger that fires when the user attempts to delete a record might invoke the alert............ then the DELETE_RECORD built-in is called to delete the current record from the block..................................... shown opposite...... IF SHOW_ALERT(’del_check’) = ALERT_BUTTON1 THEN DELETE_RECORD... ............ Oracle Forms Developer: Build Internet Applications I 16-27 ............. SHOW_ALERT returns a NUMBER constant. .......... These numbers correspond to the values of three PL/SQL constants... which are predefined by the Form Builder: If the number equals. to obtain confirmation........ Alert_Name is the name of the alert........ .... You can alternatively specify an Alert_Id (unquoted) for this argument... ALERT_BUTTON1 ALERT_BUTTON2 ALERT_BUTTON3 The Operator selected is............ you can determine which button the operator pressed by comparing the returned value against the corresponding constants.......... Button 1 Button 2 Button 3 After displaying an alert that has more than one button................

......................................Lesson 16: Runform Messages and Alerts .................................................................... BEGIN SET_ALERT_PROPERTY(’error_alert’................................................ERROR_TYPE|| ’-’||TO_CHAR(ERROR_CODE)|| ’: ’||ERROR_TEXT).......... All rights reserved........................................ ALERT_MESSAGE_TEXT...... .... 2000.... n := SHOW_ALERT(’error_alert’)................... 16-28 Oracle Forms Developer: Build Internet Applications I .... Copyright  Oracle Corporation.................................... Directing Errors to an Alert PROCEDURE Alert_On_Failure IS n NUMBER.................. END...............

...... ALERT_MESSAGE_TEXT........... Directing Errors to an Alert You may want to display errors automatically in an alert...... n := SHOW_ALERT(’error_alert’)................... Example The following user-named procedure can be called when the last form action was unsuccessful........ Oracle Forms Developer: Build Internet Applications I 16-29 ............. .......... such as ERROR_TEXT....... can be used in the SET_ALERT_PROPERTY procedure..... The built-in functions that return error information.............. The procedure fails the calling trigger and displays Error_Alert containing the error information... to construct the alert message for display...... through an On-Error trigger................................................................. BEGIN SET_ALERT_PROPERTY( ’error_alert’....................... PROCEDURE alert_on_failure IS n NUMBER...... ERROR_TYPE||’-’||TO_CHAR(ERROR_CODE)||’: ’ || ERROR_TEXT)..................................................... END.................Creating and Controlling Alerts ...........................................

. Summary • On-Error trigger intercepts system error messages......... ..... All rights reserved.. 16-30 Oracle Forms Developer: Build Internet Applications I .................. Up to three buttons are available for operator response........................................... Caution. Copyright  Oracle Corporation.....................Lesson 16: Runform Messages and Alerts ............. • On-Message trigger intercepts system informative messages................... • • Alert types: Stop.. 2000............ 2000..................... • Set system variables to suppress system messages: MESSAGE_LEVEL and SUPPRESS_WORKING........................ Summary • Application and system messages appear on message line........................................................................... Copyright  Oracle Corporation............ Change alert message with SET_ALERT_PROPERTY............. All rights reserved........... • Test for built-in failure by using FORM_SUCCESS or other built-in functions............. and Note • • Display alerts with SHOW_ALERT..

........ Caution.......... • Change alert messages with SET_ALERT_PROPERTY.. .. • Alert types: Stop........Assign a value to MESSAGE_LEVEL to specify that only messages above a specific severity level are to be used by the form.......... and Note....... you saw how to intercept system messages.... • Set system variables to suppress system messages: ........... . • On-Message trigger intercepts informative system messages.................................................................).......... • On-Error trigger intercepts system error messages............................ and how to replace them with ones that are more suitable for your application.............. • Display alerts at run time with SHOW_ALERT....... • The application and system messages appear on the Message line.......................................................Assign a value of True to SUPPRESS_WORKING to suppress all working messages.Summary ....... Summary In this lesson. Oracle Forms Developer: Build Internet Applications I 16-31 ...... You also learned how to build customized alerts for communicating with operators..... • Test for failure of built-ins by using the FORM_SUCCESS built-in function or other built-in functions.............. • Up to three buttons are available for operator response (NULL indicates that the button is not required............................................

......................................................... Note For solutions to this practice................................................................... “Practice Solutions..........Lesson 16: Runform Messages and Alerts .......... 2000............................. All rights reserved....” ....................... Practice 16 Overview This practice covers the following topics: • Using an alert to inform the operator that the customer must pay cash • Using a generic alert to ask the operator to confirm that the form should terminate Copyright  Oracle Corporation............................................................. 16-32 Oracle Forms Developer: Build Internet Applications I ............................................. see Practice 16 in Appendix A.

....... • Using an alert to inform the operator that the customer must pay cash • Using a generic alert to ask the operator to confirm that the form should terminate .................................................. Practice 16 Overview In this practice.......................................................................Practice 16 Overview .......................................................................... Oracle Forms Developer: Build Internet Applications I 16-33 ................................................................... you create some alerts in the ORDGXX form......... These include a general alert for questions and a specific alert that is customized for payment type..........................

.............. Save and compile the form...... Alter the When-Button-Pressed trigger on CONTROL.................. and define two buttons in the alert: Yes and No. Deploy the form on the Web to test.... Select the Stop style................................ Style: Caution............... Alter the When-Radio-Changed trigger on Payment_Type to show the Payment_Type_Alert instead of the message when a customer must pay cash... ................................ Call the SET_ALERT_PROPERTY built-in to define the message: “Do you really want to leave the form?” Test the returned value of SHOW_ALERT..............Lesson 16: Runform Messages and Alerts ........................................................................................ and call the EXIT_FORM built-in if the operator replied Yes........... The message should read “This customer must pay cash!” Suggested Title: Payment Type......... Leave the Message property blank for this alert...... 16-34 Oracle Forms Developer: Build Internet Applications I .....................Exit_Button that uses Question_Alert to ask the operator to confirm that the form should terminate... Create a generic alert called Question_Alert that allows Yes and No replies...... Practice 16 1 Create an alert in ORDGXX called Payment_Type_Alert with a single 2 3 4 5 OK button................................

... Query Triggers .........................17 .....

............................................................................... Schedule Topic Lecture Practice Total Timing 60 minutes 30 minutes 90 minutes .................................. 17-2 Oracle Forms Developer: Build Internet Applications I .Lesson 17: Query Triggers .. All rights reserved.......................................................................................... you should be able to do the following: • Explain the processes involved in querying a data block • • Describe query triggers and their scope • Control trigger action based on the form query status Write triggers to supplement query results and screen query conditions Copyright  Oracle Corporation........................................................ Objectives After completing this lesson................ 2000...........................

................................................................................................................ Introduction Overview In this lesson...................... You can customize the query process as necessary......................................................... you learn how to control events associated with queries on base table data blocks...........................................................Introduction ........................................ . Oracle Forms Developer: Build Internet Applications I 17-3 . and supplement the results returned by a query.............

..... SELECT..... .................................................................................... All rights reserved...........................Lesson 17: Query Triggers ............ 17-4 Oracle Forms Developer: Build Internet Applications I ............................................. 2000..................................... Query Processing Fire Fire Pre-Query Pre-Query trigger trigger Construct Construct SELECT.............................................................. Abort query on failure Perform Perform query query Fetch a row into a new record Mark Mark record record as as valid valid Flush record on failure Fire Fire Post-Query Post-Query trigger trigger Validate Validate any any record record changes changes Copyright  Oracle Corporation.................................

.......................... either by the operator or by a built-in subprogram....... based on any existing criteria in the block (either entered by the operator or by the Pre-Query)........................... 7 Form Builder performs item and record validation if the record has changed (due to a trigger)........ and are usually defined on the block where the query takes place... With these triggers you can add to the normal Form Builder processing of records. If it fails................................................ ..... fire due to the query process itself...... 5 The record is marked Valid..... if the Fire in Enter Query Mode property of the associated trigger is enabled The query triggers............. this record is flushed from the block. if the required conditions are not suitable................. Form Builder fires the Pre-Query trigger if defined.......... the following major events take place: 1 In Enter Query mode. 3 The query is performed... 4 Form Builder fetches the column values of a row into the base table items of a new record in the block. 8 Step 4 is repeated for any remaining records of this query.......................Query Triggers ......... 2 If the Pre-Query succeeds... triggers are associated with a query in one of two ways: • A trigger fires due to the query process itself For example: Pre-Query and Post-Query • An event can fire a trigger in Enter Query mode.................................... or possibly abandon a query before it is even executed...... Form Builder Query Processing When a query is initiated on a data block.. Query Triggers Generally................................. Form Builder constructs the query SELECT statement.............. Pre-Query and Post-Query...... Oracle Forms Developer: Build Internet Applications I 17-5 .......... 6 Form Builder fires the Post-Query trigger.

. All rights reserved....... :ROWID base_table FROM WHERE default_where_clause AND (example_record_conditions) AND (query_where_conditions) ORDER BY default_order_by_clause | query_where_order_by SELECT INTO Slightly different for COUNT Copyright  Oracle Corporation................................ 2000........Lesson 17: Query Triggers .... ......... SELECT Statements Issued base_column.............................................. ROWID :base_item........................................................................................................................................................ ................................. ......... 17-6 Oracle Forms Developer: Build Internet Applications I .............

..... ROWID INTO :base_item.. base_column......................... SELECT Statements Issued During Query Processing If you have not altered default query processing................... :ROWID FROM base_table WHERE default_where_clause AND (example_record_conditions) AND (query_where_conditions) ORDER BY default_order_by_clause | query_where_order_by SELECT COUNT(*) FROM base_table WHERE default_where_clause AND (example_record_conditions) AND (query_where_conditions) ORDER BY default_order_by_clause | query_where_order_by Note: The vertical bar ( | ) in the ORDER BY clause indicates that either of the two possibilities can be present............ .......................................................................SELECT Statements Issued During Query Processing ............................ If you want to count records that satisfy criteria specified in the Query/Where dialog box.................... ................. The entire WHERE clause is optional.. .......... Oracle Forms Developer: Build Internet Applications I 17-7 ...... Form Builder issues a SELECT statement when you want to retrieve or count records... Form Builder retrieves the ROWID only when the Key Mode block property is set to Unique (the default).:base_item...................................... ............... enter one or more variables and press Count Query in the Example Record......................... . SELECT base_column.... The ORDER BY clause is also optional.................

............................................ ........... 2000................................................................................................................ WHERE Clause • Three sources for the WHERE clause: – WHERE clause block property – Example Record – Query/Where dialog box • WHERE clauses are combined by the AND operator Copyright  Oracle Corporation.. All rights reserved..........Lesson 17: Query Triggers .... ORDER BY Clause • Two sources for the ORDER BY clause: – ORDER BY clause block property – Query/Where dialog box • Second source for ORDER BY clause overrides the first one Copyright  Oracle Corporation.............. All rights reserved........... 2000.................................. 17-8 Oracle Forms Developer: Build Internet Applications I .................................................................

........................................................... the different conditions will all be used and linked with an AND operator........... Three Sources for the WHERE Clause • WHERE clause block property • Example Record • Query/Where dialog box If more than one source is present........................ WHERE and ORDER BY Clauses The WHERE and ORDER BY clauses of a default base table SELECT statement are derived from several sources........ It is important to know how different sources interact............. Note: You can change the WHERE clause and ORDER BY clause block properties at run time by using the SET_BLOCK_PROPERTY built-in..... ....WHERE and ORDER BY Clauses ......... Oracle Forms Developer: Build Internet Applications I 17-9 ....................................................................................................................................... Two Sources for the ORDER BY Clause • ORDER BY clause block property • Query/Where dialog box An ORDER BY clause specified in the Query/Where dialog box overrides the value of the ORDER BY clause block property.......................................

........ 17-10 Oracle Forms Developer: Build Internet Applications I ....... END IF... Copyright  Oracle Corporation.............................. Using NAME_IN in the code ensures that the correct datatype is used.............. For example...................DATE_ORDERED)|| TO_CHAR(:S_ORD........DATE_SHIPPED) IS NULL THEN MESSAGE(’You must query by Order ID or Date’)....Lesson 17: Query Triggers ... Instructor Note With a restricted query................. RAISE form_trigger_failure........ All rights reserved........................................................ID)|| TO_CHAR(:S_ORD...... .. this trigger code can cause an error...... before query is performed TO_CHAR(:S_ORD.................... Pre-Query Trigger • • IF Defined at block level Fires once................................................................................... entering >10 for the ID item causes an error because the TO_CHAR in the trigger code around the ID item................. 2000.....

........ before Form Builder executes the query)... Writing Query Triggers Pre-Query Trigger You must define this trigger at block level or above... Oracle Forms Developer: Build Internet Applications I 17-11 ..............Writing Query Triggers .............. RAISE form_trigger_failure......... If the operator has initiated the query... We will look at doing this later..... This prevents attempts at very large queries....................... while the form is in Enter Query mode (that is...................................... Note: Pre-Query is useful for assigning values passed from other Oracle Forms Developer modules.........date_shipped) IS NULL THEN MESSAGE(’You must query by Order ID or Date’)...... the trigger fires after the query criteria is entered..date_ordered)|| TO_CHAR(:S_ORD............... .......id)|| TO_CHAR(:S_ORD...................................... so that the query is related to data elsewhere in the session....... IF TO_CHAR(:S_ORD.................... It fires for either a global or restricted query....... or Date Shipped. and to fail the query process if the conditions are not satisfactory for the application • To add criteria for the query by assigning values to base table items Example This Pre-Query trigger on the S_ORD block permits queries only if there is a restriction on either the Order ID........................................ This means you can use Pre-Query as follows: • To test the operator’s query conditions........ Date Ordered.............. END IF...........................

...........id............. Copyright  Oracle Corporation.........Lesson 17: Query Triggers ... .............. All rights reserved....................... All rights reserved. • ORDER BY is not relevant... The query must return one row for success................. 17-12 Oracle Forms Developer: Build Internet Applications I ....... Code exception handlers....................................... The INTO clause is mandatory...........................lineitem_count FROM WHERE S_ITEM ord_id = :S_ORD............ 2000...... Post-Query Trigger • Fires for each fetched record (except during array processing) • Use to populate nondatabase items and calculate statistics SELECT COUNT(ord_id) INTO :S_ORD... Using SELECT Statements in Triggers • • • • Form Builder variables are preceded by a colon...................... Copyright  Oracle Corporation.......................................... with a variable for each selected column or expression........................................... 2000.....................

.................lineitem_count FROM S_ITEM WHERE ord_id = :S_ORD....... Post-Query Trigger This trigger is defined at block level or above........................ and must define a receiving variable for each selected column or expression.... and displays this number as a summary value in the nonbase table item :Lineitem_count........... Here is a reminder of some other rules regarding SELECT statements in PL/SQL: • A single row must be returned from the query..Writing Query Triggers ..........id.............. • The INTO clause is mandatory........ SELECT COUNT(ord_id) INTO :S_ORD................ Note that the trigger fires only on the initial fetch of a record..................... You usually want to match a form value with a unique column value in your restriction.......... • Code exception handlers in your PL/SQL block to deal with possible exceptions raised by SELECT statements............ Oracle Forms Developer: Build Internet Applications I 17-13 .............. Post-Query fires for each record that is fetched into the block as a result of a query.......... form items or global variables in the INTO clause.. not when a record is subsequently scrolled back into view a second or third time....................... colons are required in front of Form Builder variables to distinguish them from PL/SQL variables and database columns.................. ........ Use Post-Query as follows: • To populate nondatabase items as records are returned from a query • To calculate statistics Example This Post-Query trigger on the S_ORD block selects the total count of line items for the current Order....... Again....... • ORDER BY and other clauses that control multiple-row queries are not relevant (unless they are part of an Explicit Cursor definition)...................................................... populates the Lineitem_Count item through the INTO clause.... Using SELECT Statements in Triggers The previous trigger example. or else an exception is raised that terminates the normal executable part of the block.... You can use PL/SQL variables...............

............... 2000.................................................................................................... Query Array Processing • • Reduces network traffic Enables Query Array processing: – Enable Array Processing option – Set Query Array Size property • • Query Array Size property Query All Records property Copyright  Oracle Corporation........................................................ All rights reserved.........................................Lesson 17: Query Triggers ............ 17-14 Oracle Forms Developer: Build Internet Applications I ....................................................... .........................

..In the Object Navigator.......... you can determine the array size to optimize performance for your needs........................ Oracle Forms Developer: Build Internet Applications I 17-15 ............Under the Records category......... ........... set the Query Array Size property to a number that represents the number of records in the array for array processing... Enabling Array Processing for Queries 1 Setting preferences: ................Click the Runtime tab..............................Select Tools—>Preferences........... For both querying and DML operations................... because Form Builder fetches and displays only one record at a time. a size of 10 fetches up to ten records before displaying any of them...... a structure (array) containing multiple records is sent to or returned from the server for processing.......... select the Data Blocks node.............Select the Array Processing check box....... A size of 1 provides the fastest perceived response time............. ... 2 Setting properties: ....... By contrast........ • No: Fetches the number of records specified by the Query Array Size block property... ...... This lesson focuses on array query processing......Double-click the Data Blocks icon to display the Property Palette................ .... Query Array Processing The default behavior of Form Builder is to process records one at a time............... With array processing. however........... Query Array Size Property This property specifies the maximum number of records that Form Builder should fetch from the database at one time...... Form Builder supports both array fetch processing and array DML processing.......... the larger size reduces overall processing time by making fewer calls to the database for records.. ....Query Array Processing .................. • Yes: Fetches all records from query...... Query All Records Property Specifies whether all the records matching the query criteria should be fetched into the data block when a query is executed.........

.....When-Validate-Record ....................MODE – NORMAL – ENTER-QUERY – QUERY Copyright  Oracle Corporation..When-New-Block-Instance ................................... Test mode during execution with :SYSTEM..... except: ......Lesson 17: Query Triggers ........ set the Fire in Enter Query Mode property to Yes........... Set to fire in Enter-Query Mode property.......When-New-Form-Instance .................When-Create-Record .........When-Remove-Record ..................When-Database-Record .....When-Image-Activated .... 2 In the Property Palette............... Coding for ENTER-QUERY Mode • • • Some triggers may fire in Enter-Query mode.....When-Validate-Item To create a trigger that fires in Enter Query mode: 1 In the Object Navigator.........................triggers................ select a trigger.. Instructor Note The following triggers may fire in Enter Query mode: • Key• On-Error • On-Message • When....... ...................... All rights reserved.............................................. 17-16 Oracle Forms Developer: Build Internet Applications I .......... 2000.....................

................... Set it to No in the Property Palette if you only want the trigger to fire in Normal mode....... which lists each trigger and whether this property can be set............ and the LOV is required to help with query criteria as well as data entry...................................................... Fire in Enter Query Mode Property This property determines whether Form Builder fires a trigger if the associated event occurs in Enter Query mode.................. the Fire in Enter Query Mode property is set to Yes for triggers that accept this.......... consult Form Builder online Help..........Coding Triggers for Enter Query Mode . You need to consider the trigger type and actions in these cases........................... This trigger has Fire in Enter Query Mode set to Yes (default for this trigger type): IF SHOW_LOV(’Customers’) THEN MESSAGE(’Selection successful’)............................................................ Coding Triggers for Enter Query Mode Some triggers that fire when the form is in Normal mode (during data entry and saving) may also be fired in Enter Query mode. Not all triggers can do this... then the When-Button-Pressed trigger needs to fire in both modes....... ............... END IF.................................... Example If you provide a button for the operator to invoke an LOV..................... By default... Oracle Forms Developer: Build Internet Applications I 17-17 ...........

............................ All rights reserved.......... ELSE EXECUTE_QUERY.............. 2000.. 17-18 Oracle Forms Developer: Build Internet Applications I .................... • • • Some built-ins are illegal................................ END IF..................................................................................................Lesson 17: Query Triggers ......MODE = ’NORMAL’ THEN ENTER_QUERY................. Copyright  Oracle Corporation......................... You cannot navigate to another record in the current form... ........................................... Consult online Help. Coding for ENTER-QUERY Mode • Example IF :SYSTEM............

.

....................................... All rights reserved...................Lesson 17: Query Triggers ................................................................................................................................ 17-20 Oracle Forms Developer: Build Internet Applications I .............................. .............. 2000............ Overriding Default Query Processing Trigger Do-the-Right-Thing Built-in On-Close On-Count COUNT_QUERY On-Fetch FETCH_RECORDS Pre-Select On-Select SELECT_RECORDS Post-Select Copyright  Oracle Corporation..............................................................

.......... Some of the transactional triggers can also be used to replace default query processing. Oracle Forms Developer: Build Internet Applications I 17-21 .............................Overriding Default Query Processing .......................................................................................................................... do not use “Do-the-right-thing” to replace default processing............................. Additional Transactional Triggers for Query Processing Trigger On-Close On-Count On-Fetch Pre-Select On-Select Post-Select Do-the-Right-Thing Built-in COUNT_QUERY FETCH_RECORDS SELECT_RECORDS .................................................... Overriding Default Query Processing You can use certain transactional triggers to replace default commit processing.................................... You can use “Do-the-right-thing” built-ins to augment default query processing..........................

.... – The query is closed by the user or by ABORT_QUERY........................ • On-Select replaces open cursor.............................. This built-in is included primarily for applications using transactional triggers to run against a data source other than Oracle.......... but have not yet been placed on the block list of active records................ All rights reserved........................................ . Copyright  Oracle Corporation............... 2000........... 17-22 Oracle Forms Developer: Build Internet Applications I ..............Lesson 17: Query Triggers ........................................ – It raises FORM_TRIGGER_FAILURE..................................... parse........................... it creates a record on the block waiting list.. Instructor Note When the CREATE_QUERIED_RECORD built-in is called from an On-Fetch trigger. Overriding Default Query Processing • On-Fetch continues to fire until: – It fires without executing CREATE_QUERIED_RECORD............ and execute phases.... The waiting list is an intermediary record buffer that contains records that have been fetched from the data source...........................

..................... Characteristics of Transactional Triggers for Query Processing Trigger On-Close On-Count On-Fetch Characteristic Fires when Form Builder closes a query (It augments....................Overriding Default Query Processing ......... default processing........... ..... However... Oracle Forms Developer: Build Internet Applications I 17-23 ............. but before it fetches the records Uses for Transactional Triggers for Query Processing Transactional triggers for query processing are primarily intended to access certain data sources other than Oracle............ rather than replaces............... and execute phases of a query................) The trigger continues to fire until: • Pre-Select On-Select Post-Select No queried records are created during a single execution of the trigger • The query is closed by the user or by the ABORT_QUERY built-in is executed from another trigger • The trigger raises FORM_TRIGGER_FAILURE Fires after Form Builder has constructed the block SELECT statement based on the query conditions.................... parse..............) Fires after Form Builder has constructed and issued the block SELECT statement........................................ but before it issues this statement Fires when Form Builder would usually issue the block SELECT statement (The trigger replaces the open cursor.............................................................. you can also use these triggers to implement special functionality by augmenting default query processing against an Oracle database...................................................) Fires when Form Builder would usually perform default Count Query processing to determine the number of rows that match the query conditions Fires when Form Builder performs a fetch for a set of rows (You can use the CREATE_QUERIED_RECORD built-in to create queried records if you want to replace default fetch processing.

.....................MODE SYSTEM............... .....LAST_QUERY – Contains bind variables (ORD_ID = :1) before SELECT_RECORDS – Contains actual values (ORD_ID = 102) after SELECT_RECORDS Copyright  Oracle Corporation............................ 17-24 Oracle Forms Developer: Build Internet Applications I ...............Lesson 17: Query Triggers ................................................................................................................................................. All rights reserved.... Obtaining Query Information at Run Time • • SYSTEM.................................. 2000.......................................

...................LAST_QUERY Use SYSTEM.........LAST_QUERY to obtain the text of the base-table SELECT statement that was last executed by Form Builder. ORD_ID = 102)........ If the system variable is used after Form Builder has implicitly executed the SELECT_RECORDS built-in. use system variables and builtins to obtain information about queries........ For example.. the SELECT statement contains the actual search values (for example................... The three values are NORMAL....MODE Use the SYSTEM................... Using SYSTEM............... the system variable contains bind variables during the Pre-Select trigger and actual search values during the Post-Select trigger.................................. the SELECT statement contains bind variables (for example..... ORD_ID = :1)............... If a user has entered query conditions in the Example Record...................................MODE system variable to obtain the form mode.... .........................Obtaining Query Information at Run Time .... Oracle Forms Developer: Build Internet Applications I 17-25 ...... Using SYSTEM........................ ENTER_QUERY............... We discussed this system variable in the section “Finding Out the Current Mode” in this lesson...... Obtaining Query Information at Run Time If you want to exercise more control over your queries..... If the system variable is used before Form Builder has implicitly executed the SELECT_RECORDS built-in........................ the exact form of the SELECT statement depends on when this system variable is used............ and QUERY....

................................................................. Obtaining Query Information at Run Time • GET_BLOCK_PROPERTY SET_BLOCK_PROPERTY – Get and set: DEFAULT_WHERE ORDER_BY QUERY_ALLOWED QUERY_HITS – Get only: QUERY_OPTIONS RECORDS_TO_FETCH Copyright  Oracle Corporation.........................................Lesson 17: Query Triggers ............................ .................... All rights reserved............. 17-26 Oracle Forms Developer: Build Internet Applications I ........ Obtaining Query Information at Run Time • GET_ITEM_PROPERTY SET_ITEM_PROPERTY – Get and set: CASE_INSENSITIVE_QUERY QUERYABLE QUERY_ONLY – Get only: QUERY_LENGTH Copyright  Oracle Corporation.. 2000................................................................................ 2000........................ All rights reserved..........................

...........................Obtaining Query Information at Run Time ................................... • CASE_INSENSITIVE_QUERY (*) • QUERYABLE (*) • QUERY_ONLY (*) • QUERY_LENGTH Instructor Note QUERYABLE determines if the item can be included in a query against the base table of the block to which the item belongs................................ Only the properties marked with an asterisk can be set.... Only the properties marked with an asterisk can be set................................................................ Oracle Forms Developer: Build Internet Applications I 17-27 ... Using GET_BLOCK_PROPERTY and SET_BLOCK_PROPERTY The following block properties may be useful for obtaining query information................................... ............................................................................. QUERY_ONLY specifies that an item can be queried but that it should not be included in any INSERT or UPDATE statement that Form Builder issues for the block at run time................ • DEFAULT_WHERE (*) • ORDER_BY (*) • QUERY_ALLOWED (*) • QUERY_HITS (*) • QUERY_OPTIONS • RECORDS_TO_FETCH Using GET_ITEM_PROPERTY and SET_ITEM_PROPERTY The following item properties may be useful for getting query information..............

Lesson
17: Query Triggers
......................................................................................................................................................

Summary

A Pre-Query trigger fires before a query executes.
Use it to check or modify query conditions.

A Post-Query trigger fires as each record is
fetched (except array processing). Use it to
perform calculations and populate additional
items.

Copyright  Oracle Corporation, 2000. All rights reserved.

Summary

Some triggers can fire in both Normal and Enter
Query modes:
– Test the current mode with SYSTEM.MODE.
– Some built-ins are illegal in Enter Query mode.

Obtain query information at run time:
– SYSTEM.MODE
– SYSTEM.LAST_QUERY

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
17-28
Oracle Forms Developer: Build Internet Applications I

Summary
......................................................................................................................................................

Summary
In this lesson, you learned how to control the events associated with queries on base
table blocks.
• The Pre-Query trigger fires before the query executes. This trigger is
defined at the block level or above. Use the Pre-Query trigger to check
or modify query conditions.
• The Post-Query trigger fires as each record is fetched (except array
processing). This trigger is defined at the block level or above. Use the
Post-Query trigger to perform calculations and populate additional
items.
• Some triggers can fire in both Normal and Enter Query modes.
- Use SYSTEM.MODE to test the current mode.
- Some built-ins are illegal in Enter Query mode.
• Override default query processing by using “Do-the-right-thing”
built-ins.
• Obtain query information at run-time by using:
- SYSTEM.MODE, SYSTEM.LAST_QUERY
- Some properties of GET/SET_BLOCK_PROPERTY and
GET/SET_ITEM_PROPERTY

......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
17-29

Lesson
17: Query Triggers
......................................................................................................................................................

Practice 17 Overview

This practice covers the following topics:

Populating customer names and sales
representative names for each row of the S_ORD
block

Populating descriptions for each row of the
S_ITEM block

Disabling the effect of the Exit button in Enter
Query mode

Adding two check boxes to enable case-sensitive
and exact match query

Copyright  Oracle Corporation, 2000. All rights reserved.

Note
For solutions to this practice, see Practice 17 in Appendix A, “Practice Solutions.”

......................................................................................................................................................
17-30
Oracle Forms Developer: Build Internet Applications I

Practice 17 Overview
......................................................................................................................................................

Practice 17 Overview
In this practice, you create two query triggers to populate nonbase table items. You
will also change the default query interface to enable case-sensitive and exact match
query.
• Populating customer names and sales representative names for each row
of the S_ORD block
• Populating descriptions for each row of the S_ITEM block
• Disabling the effect of the Exit button in Enter Query mode
• Adding two check boxes to enable case-sensitive and exact match query

......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
17-31

Lesson
17: Query Triggers
......................................................................................................................................................

Practice 17
1 In the ORDGXX form, write a trigger that populates the

Customer_Name and the Sales_Rep_Name for every row fetched by a
query on the S_ORD block.
2 Write a trigger that populates the Description for every row fetched by a
query on the S_ITEM block.
3 Ensure that the Exit_Button has no effect in Enter Query mode.
Ensure that the When-Radio-Changed trigger has no effect in Enter
Query mode.
4 Adjust the default query interface. Open the CUSTOMERS form
module. Add a check box called CONTROL.Case_Sensitive to the form
so that the user can specify whether or not a query for a customer name
should be case sensitive. You can import the pr17_4.txt file into the
When-Checkbox-Changed trigger. Set the initial value property to “Y.”
In the CONTROL block, add a check box (called CONTROL.Case_Sensitive as
shown below) to it, and create the following trigger. Set the “Mouse Navigate”
property to No.
When-Checkbox-Changed Trigger on the CONTROL.Case_Sensitive Item
(Checkbox)
IF NVL(:CONTROL.case_sensitive, ’Y’) = ’Y’ THEN
SET_ITEM_PROPERTY(’S_CUSTOMER.name’, CASE_INSENSITIVE_QUERY,
PROPERTY_FALSE);
ELSE
SET_ITEM_PROPERTY(’S_CUSTOMER.name’,CASE_INSENSITIVE_QUERY,
PROPERTY_TRUE);
END IF;
5 Add a check box called CONTROL.Exact_Match to the form so that the

user can specify whether or not a query condition for a customer name
should exactly match the table value. (If a nonexact match is allowed,
the search value can be part of the table value.) You can import the
pr17_5.txt file into the Pre-Query Trigger. Set the initial value
property to “Y.” Add another check box (called
CONTROL.Exact_Match as shown below) to the CONTROL block and
create the following trigger. Set the Mouse Navigate property to No.
Pre-Query Trigger on the S_CUSTOMER Block
IF NVL( :CONTROL.exact_match, ’Y’ ) = ’N’ THEN
:S_CUSTOMER.name := ’%’ || :S_CUSTOMER.name || ’%’;
END IF;

......................................................................................................................................................
17-32
Oracle Forms Developer: Build Internet Applications I

18
................................

Validation

Lesson
18: Validation
......................................................................................................................................................

Objectives

After completing this lesson, you should be able to
do the following:

Explain the effects of the validation unit upon a
form


List Form Builder validation properties
Control validation by using triggers

Copyright  Oracle Corporation, 2000. All rights reserved.

Schedule
Topic
Lecture
Practice
Total

Timing
35 minutes
30 minutes
65 minutes

......................................................................................................................................................
18-2
Oracle Forms Developer: Build Internet Applications I

Introduction
......................................................................................................................................................

Introduction
Overview
In this lesson, you will learn how to supplement item validation by using both object
properties and triggers. You will also learn to control when validation occurs.

......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
18-3

Lesson
18: Validation
......................................................................................................................................................

Validation

Form Builder validates at the following levels:
Form level
Block level
Record level

Item level

Copyright  Oracle Corporation, 2000. All rights reserved.

Validation

Validation occurs when:
– [Enter] key or ENTER Built-in is
obeyed
– Operator or trigger leaves the validation unit
(includes a Commit)

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
18-4
Oracle Forms Developer: Build Internet Applications I

Validation Process
......................................................................................................................................................

Validation Process
Form Builder performs a validation process at several levels to ensure that records and
individual values follow appropriate rules. If validation fails, then control is passed
back to the appropriate level, so that the operator can make corrections. Validation
occurs at:
• Item level: Form Builder records a status for each item to determine
whether it is currently valid. If an item has been changed and is not yet
marked as valid, then Form Builder first performs standard validation
checks to ensure that the value conforms to the item’s properties. These
checks are carried out before firing any When-Validate-Item triggers that
you have defined. Standard checks include the following:
- Format mask
- Required (if so, then is the item null?)
- Data type
- Range (Lowest-Highest Allowed Value)
- Validate from List (see later in this lesson)
• Record level: After leaving a record, Form Builder checks to see
whether the record is valid. If not, then the status of each item in the
record is checked, and a When-Validate-Record trigger is then fired, if
present. When the record passes these checks, it is set to valid.
• Block and form level: At block or form level, all records below that level
are validated. For example, if you commit (save) changes in the form,
then all records in the form are validated, unless you have suppressed
this action.
When Does Validation Occur?
Form Builder carries out validation for the validation unit under the following
conditions:
• The [Enter] key is (ENTER command is not necessary mapped to the
key that is physically labeled Enter) pressed or the ENTER built-in
procedure is run (whose purpose is to force validation immediately).
• The operator or a trigger navigates out of the validation unit. This
includes when changes are committed. The default validation unit is
item, but can also be set to record, block, or form by the designer. The
validation unit is discussed in the next section.

......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
18-5

........ 2000.......................... All rights reserved................................................................. You may want to set Validation Unit to a higher level........................................................................... Instructor Note Show the Validation Unit property in Form Builder................................ and demonstrate its effect at run time.............................................Lesson 18: Validation ...... .................. 18-6 Oracle Forms Developer: Build Internet Applications I ............................... Validation Unit Property Copyright  Oracle Corporation.

... even without triggers...................... an item-level validation unit means that Form Builder validates changes when an operator navigates out of a changed item.......................... • The application runs in a block-mode environment (block level)........ Oracle Forms Developer: Build Internet Applications I 18-7 ............. and it can be set in the Property Palette to any of the following: • Default • Item • Record • Block • Form The default setting is item level......................... and you want to postpone traffic until the operator has completed a record (record level).............. All outstanding items and records are validated together... You might set a validation unit above item level under one of the following conditions: • Validation involves database references.........Using Object Properties to Control Validation .......................... Do this by setting properties for the form and for individual items within it. Validation unit is a property of the form module........... .............. The Validation Unit The validation unit defines the maximum amount of data an operator can enter in the form before Form Builder initiates validation. The default setting is usually chosen...... standard validation checks and firing the When-Validate-Item trigger of that item can be done immediately...... the above checks are postponed until navigation moves out of that unit... As a result..... In practice........................ or form level)................ At higher validation units (record....... including the firing of When-Validate-Item and When-Validate-Record triggers........ This way..... Using Object Properties to Control Validation You can control when and how validation occurs in a form.. operators are aware of validation failure as soon as they attempt to leave the item................................ block.................................

............................ 2000.................................................................................. Instructor Note Set the Validate from List property on an item to which you have already attached a suitable LOV................ build and run the form to show the use of this feature...... LOV for Validation TERRY LOV Full list ENAME HDATE --------------- --------------- MARTIN 20-FEB-1981 MARTINEZ 22-FEB-1981 SEDAT 06-MAR-1996 WARD 06-FEB-1995 ALAN 08-SEP-1981 Partial list MART Valid WARD AL Auto complete ALAN Copyright  Oracle Corporation.....Lesson 18: Validation .............................................. Then... All rights reserved................................................................................. ................... 18-8 Oracle Forms Developer: Build Internet Applications I .....................

....... The following events then occur. Note: Make sure that LOVs you create for validation purposes have the validation column defined first.......... validation succeeds....... • If the item value causes multiple records to be found in the LOV. Do this by setting the Validate from List property to Yes for the item.... Using LOVs for Validation When you attach an LOV to a text item by setting the LOV property of the item. so that the operator must choose......... • If the item’s value causes a single record to be found in the LOV.......................................................Using Object Properties to Control Validation ............ Form Builder displays the LOV and uses the text item value as the search criteria to automatically reduce the list................... then the full LOV contents are displayed to the operator............................................. • If no match is found.................. and processing continues normally.......... At validation time........ the LOV is not displayed.................... do not use the LOV for Validation property for large LOVs.......... then the full LOV column value is returned to the item (providing that the item is defined as the return item in the LOV)......... depending on the circumstances: • If the value in the text item matches one of the values in the first column of the LOV..... with a display width greater than 0.. you can optionally use the LOV contents to validate data entered in the item................... For performance reasons.... Form Builder then automatically uses the item value as a non case-sensitive search string on the LOV contents.. ................ The item then passes this validation phase........ Oracle Forms Developer: Build Internet Applications I 18-9 . You also need to define the Return Item for the LOV column as the item being validated............ but is a partial value of the LOV value..........

..... form_trigger_failure........ 18-10 Oracle Forms Developer: Build Internet Applications I ............................ Date!’)........... Post-Change does not fire if an item is set to Null.....................date_ordered :S_ORD........ All rights reserved.......date_ordered THEN THEN MESSAGE(’Ship MESSAGE(’Ship Date Date is is before before Order Order Date!’).. RAISE RAISE form_trigger_failure................................... Its use is not recommended in new applications... END IF......... Copyright  Oracle Corporation.... Instructor Note Introduce When-Validate-Record as an additional validation trigger...................... Students who have experience with early versions of the product (SQL*Forms V2................ and it can fire on population at query time... The Post-Change trigger is included only for compatibility with previous versions of Form Builder..date_shipped :S_ORD.. ..3) sometimes ask about using Post-Change as a validation trigger...............Lesson 18: Validation ........ 2000......... Validation Triggers • Item level When-Validate-Item • Block level When-Validate-Record IF IF :S_ORD......date_shipped << :S_ORD................. END IF.................. making it less specific to validation than the When-Validate-Object triggers.............................................................

............. RAISE form_trigger_failure....... END IF............... When-Validate-Record Trigger This trigger fires after standard record-level validation................................................date_ordered ensures that the Order Date is not later than the current (database) date: IF :S_ORD.......... Oracle Forms Developer: Build Internet Applications I 18-11 .......... which let you add your own customized actions.. When-Validate-Record must be defined at block level or above.........date_ordered > SYSDATE THEN MESSAGE(’Order Date is later than today!’)...... The trigger fires after standard item validation.. in the order they were entered...................... Example This When-Validate-Item trigger on :S_ORD..... There are also some built-in subprograms that you can call from triggers that affect validation. END IF............................ RAISE form_trigger_failure......date_shipped < :S_ORD.... you can use this trigger to perform additional checks that may involve more than one of the record’s items..... When-Validate-Item Trigger You have already used this trigger to add item-level validation..........Controlling Validation by Using Triggers . IF :S_ORD.............. ......... Controlling Validation by Using Triggers There are triggers that fire due to validation................ and input focus is returned to the item if the trigger fails............. Because Form Builder has already checked that required items for the record are valid...... when the operator has left a new or changed record........date_ordered THEN MESSAGE(’Ship Date is before Order Date!’)...................... Example This When-Validate-Record trigger on block S_ORD ensures that orders cannot be shipped before they are ordered................................

.. 18-12 Oracle Forms Developer: Build Internet Applications I .............................................................Lesson 18: Validation ................................................................. Validating User Input Customer ID 998 W-V-I SELECT ....... 2000................................................................................................. ............................customer_id Trigger failure? Copyright  Oracle Corporation......... . ............ All rights reserved....... WHERE id = :S_ORD...................

..................... and the SELECT statement will cause an exception................................Validating User Input ...................... The success or failure of the query can.... and the trigger will fail because there is no exception handler to prevent the exception from propagating to the end of the trigger..................... a matching row will not be found......................... phone INTO :S_ORD... • TOO_MANY_ROWS More than one row is returned from the query..... For an unhandled exception............................ Validating User Input While populating other items....................................... If the Customer_ID item contains a value that is not found in the table................. Example The following When-Validate-Item trigger is again placed on the Customer_ID item..... the user receives the message: FRM-40735: <trigger type> trigger raised unhandled exception <exception> ..customer_name.. the NO_DATA_FOUND exception is raised. and returns both the Name and Phone Number that correspond to the Customer ID entered by the user..... as above........... :S_ORD............. if the user enters an invalid value in the item...customer_phone FROM s_customer WHERE id = :S_ORD...... The exceptions that can occur when a single row is not returned from a SELECT in a trigger are: • NO_DATA_FOUND No rows are returned from the query... therefore............................ SELECT name......... Note: A failing When-Validate-Item trigger prevents the cursor from leaving the item..customer_id... Oracle Forms Developer: Build Internet Applications I 18-13 ............. be used to validate user input.

........................................Lesson 18: Validation ............................................................................................................................. 2000.................................... Tracking Validation Status • VALID – When validation has been successful – After records are fetched from database – After a successful post or commit – Duplicated record inherits status of source Copyright  Oracle Corporation........ 2000.... 18-14 Oracle Forms Developer: Build Internet Applications I ......................... .... All rights reserved.. Tracking Validation Status • NEW – When a record is created – Also for Copy Value from Item or Initial Value • CHANGED – When changed by user or trigger – When any item in new record is changed Copyright  Oracle Corporation....... All rights reserved........................................................

..... Item Validation Status Status Definition NEW When a record is created.... This is true even if the item is populated by the Copy Value from Item or Initial Value item properties... or by the When-Create-Record trigger.................................... Form Builder marks that record as changed..... CHANGED Form Builder marks an item as changed under the following conditions: • • VALID When the item is changed by the user or a trigger When any item in a new record is changed... or by the When-Create-Record trigger....................... To determine whether validation must be performed. VALID Form Builder marks a record as valid under the following conditions: • • • • After all items in the record have been successfully validated All records that are fetched from the database are marked as valid After successful post or commit A duplicated record inherits the status of its source .... This is true even if the item is populated by the Copy Value from Item or Initial Value item properties...... Tracking Validation Status When Form Builder leaves an object....................................... it usually validates any changes that were made to the contents of the object............................................................................................... Form Builder marks every item in that record as new................... Oracle Forms Developer: Build Internet Applications I 18-15 ...Tracking Validation Status .............................. CHANGED Whenever an item in a record is marked as changed.............................. Form Builder tracks the validation status of items and records.. all of the items in the record are marked as changed Form Builder marks an item as valid under the following conditions: • • • • All items in record that are fetched from the database are marked as valid If validation of the item has been successful After successful post or commit Each item in a duplicated record inherits the status of its source Record Validation Status Status Definition NEW When a record is created...... Form Builder marks that record as new..

............. .............. EXIT_FORM ENTER SET_FORM_PROPERTY – (......... CLEAR_ FORM...................Lesson 18: Validation .................................. VALIDATION) – (......................................................................................... 18-16 Oracle Forms Developer: Build Internet Applications I ......... All rights reserved......................... 2000........ Built-ins for Validation • • • CLEAR_BLOCK.......................... VALIDATION_UNIT) • • ITEM_IS_VALID item property VALIDATE (VALIDATION_ UNIT) Copyright  Oracle Corporation....................................................................

..... For example....VALIDATION....... That is............ You can also use this built-in to change the validation unit programmatically: SET_FORM_PROPERTY(’form_name’..................... SET_FORM_PROPERTY You can use this to disable Form Builder validation.............. COMMIT_MODE.. or the form is exited respectively.. Oracle Forms Developer: Build Internet Applications I 18-17 ................... RECORD_SCOPE................................ and you need to bypass normal validation... controls what will be done with unapplied changes when a block is cleared.. Note: Scope is one of DEFAULT_SCOPE.......... You cannot directly get and set the validation status of a record..... scope)..... When the parameter is set to NO_VALIDATE....... CLEAR_FORM...... and EXIT_FORM The first parameter to these built-ins................. changes are neither validated nor committed (by default.... ........Built-ins for Validation ... or ITEM_SCOPE.................. ITEM_IS_VALID Item Property You can use GET_ITEM_PROPERTY and SET_ITEM_PROPERTY built-ins with the ITEM_IS_VALID parameter to get or set the validation status of an item............................ it forces validation of data in the current validation unit........................... VALIDATE VALIDATE forces Form Builder to immediately execute validation processing for the indicated scope.. the form is cleared.........................VALIDATION_UNIT. BLOCK_SCOPE....... CLEAR_BLOCK......... suppose you are testing a form... ENTER The ENTER built-in performs the same action as the [Enter] key........... the operator is prompted for the action).... However... Set the Validation property to Property_False for this purpose: SET_FORM_PROPERTY(’form_name’. PROPERTY_FALSE). you can get or set the validation status of all the items in a record..... Built-ins for Validation You can use the following built-in subprograms in triggers to affect validation.

........................ 2000. and form levels...................... • Validation happens when: – [Enter] Key or ENTER built-in is activated – Control leaves the validation unit due to navigation or commit Copyright  Oracle Corporation.............. Copyright  Oracle Corporation.... Summary • Validation occurs at item............. ............Lesson 18: Validation ...................................... Summary • Standard validation occurs before trigger validation. 2000... All rights reserved........................................ All rights reserved................... • • Default validation unit is item level...................... Validation status – NEW – CHANGED – VALID • When-Validate-“object” triggers to supplement validation... 18-18 Oracle Forms Developer: Build Internet Applications I ........................................................................................... record... block....

.......... • Standard validation occurs before trigger validation....................................CHANGED .................) .... ....The [Enter] Key is pressed or the ENTER built-in procedure is run (to force validation immediately........Summary ....................... Oracle Forms Developer: Build Internet Applications I 18-19 ... • The Default validation unit is item level....... • Validation happens when: ................................Control leaves the validation unit due to navigation or Commit......... then the status of each item in the record is checked.....NEW ................ • Validation occurs at three levels: ............. Summary In this lesson....................................) ....................................Block and form level: To ensure that the all records below the level are validated...........VALID • The When-Validate-“object” triggers supplement standard validation......Item level: To ensure that the value conforms to the item’s properties ......................... and to control when validation occurs..Record level: To ensure that the record is valid (If it is not.... you learned to use additional validation features in Form Builder... • Validation Status: ..........

........... 2000........................... 18-20 Oracle Forms Developer: Build Internet Applications I ..” ............................................ Note For solutions to this practice........................ and IDs when a customer ID is changed • Writing a validation trigger to populate the name and the price of the product when the product ID is changed Copyright  Oracle Corporation................. “Practice Solutions........Lesson 18: Validation ......... All rights reserved......................................................................... Practice 18 Overview This practice covers the following topics: • Validating the Sales Representative item value by using an LOV • Writing a validation trigger to check that the shipped date is not before the ordered date • Populating customer names...................................... sales representative names..................................................... see Practice 18 in Appendix A...

.

.......................................................................................................................................... Practice 18 1 .......................................................................................................................... 18-22 Oracle Forms Developer: Build Internet Applications I ..............Lesson 18: Validation ...........................

................ 2000............................................ All rights reserved......... you should be able to do the following: • Distinguish between internal and external navigation • • Describe and use navigation triggers Identify built-ins that cause navigation Copyright  Oracle Corporation...............................Lesson 19: Navigation .................................................................................... Schedule Topic Lecture Practice Total Timing 45 minutes 20 minutes 65 minutes ............. 19-2 Oracle Forms Developer: Build Internet Applications I .................................................................................. Objectives After completing this lesson..........................

....... Objectives After completing this lesson..... All rights reserved................................................ you should be able to do the following: • Distinguish between internal and external navigation • • Describe and use navigation triggers Identify built-ins that cause navigation Copyright  Oracle Corporation........................................... 19-2 Oracle Forms Developer: Build Internet Applications I .. Schedule Topic Lecture Practice Total Timing 45 minutes 20 minutes 65 minutes ..............Lesson 19: Navigation .............................. 2000............................................................................................................................................................

.................................... This lesson looks at the different methods of forcing navigation both visibly and invisibly......................... ........................................................................Introduction ................................................................................................ Introduction Overview Form Builder offers a variety of ways to control cursor movement........................................................... Oracle Forms Developer: Build Internet Applications I 19-3 ...............

... ............................. 19-4 Oracle Forms Developer: Build Internet Applications I ................................... 2000.......................................... About Navigation • What is the navigational unit? – Outside the form – Form – Block – Record – Item • • Entering and leaving objects What happens if navigation fails? Copyright  Oracle Corporation.......................................Lesson 19: Navigation ................................................................................................................................ All rights reserved............................

....... Form Builder leaves and enters objects............... it exits the form.......... internal object that determines the navigational state of a form....................... Entering and Leaving Objects During navigation..About Navigation ...................... About Navigation The following sections introduce a number of navigational concepts to help you to understand the navigation process.............. Note that the cursor is still at its initial position.. Entering an object means changing the navigation unit from the object above in the hierarchy............. external object that indicates the current input focus....... The Cursor and How It Relates to the Navigation Unit The cursor is a visible... the navigation unit acts as a probe........ In this sense............ ........... Form Builder will not move the cursor until the navigation unit has successfully become the target item............... What Is the Navigational Unit? The navigational unit is an invisible................................. What Happens If Navigation Fails? If navigation fails............... Oracle Forms Developer: Build Internet Applications I 19-5 ...................... Form Builder reverses the navigation path and attempts to move the navigation unit back to its initial location. If Form Builder cannot move the navigation unit back to its initial location........ The navigation unit can be one of the objects in the following hierarchy: • Outside the form • Form • Block • Record • Item When Form Builder navigates................. it changes the navigation unit moving through this object hierarchy until the target item is reached... Form Builder uses the navigation unit to keep track of the object that is currently the focus of a navigational process.......................... Leaving an object means changing the navigation unit to the object above................................

....................................................Lesson 19: Navigation ............................... 2000.... All rights reserved............................................................................................ 19-6 Oracle Forms Developer: Build Internet Applications I ................. 2000............................... Navigation Properties • Item – Enabled – Keyboard navigable – Mouse navigate – Previous navigation item – Next navigation item Copyright  Oracle Corporation.............................. Navigation Properties • Form module – Mouse navigation limit – First navigation data block • Block – Navigation style – Previous navigation data block – Next navigation data block Copyright  Oracle Corporation...................................... All rights reserved...... ......

....... Oracle Forms Developer: Build Internet Applications I 19-7 .............) Property Navigation Style Previous Navigation Block Next Navigation Block Enabled Keyboard Navigable Mouse Navigate Previous Navigation Item Next Navigation Item Note: In a bitmapped environment.................................................... you can use the mouse to navigate to any enabled item regardless of its position in the navigational order... There are two other navigation properties that you can set for the form module: Mouse Navigation Limit and First Navigation Block...........Controlling Navigation ....................................................................................................... You have seen navigation properties for blocks and items........................ Form Module Properties Mouse Navigation Limit First Navigation Block Object Block Item Function Determines how far outside the current item the user can navigate with the mouse Specifies the name of the block to which Form Builder should navigate on form startup (Setting this property does not override the order used for committing..................................................................... .. Controlling Navigation You can control the path through an application by controlling the order in which the user navigates to objects.......................

.................................................. none of the navigation events listed in the above slide occur................................... Instructor Note Point out that with Mouse Navigate set to No................Lesson 19: Navigation ........................... 2000................................................................. All rights reserved.... 19-8 Oracle Forms Developer: Build Internet Applications I ................................................................................... Mouse Navigate Property = Yes Exit item Exit record ^ x Exit block v Enter block Enter record Enter item Copyright  Oracle Corporation............... ...........

...............VBX Control ............... and is valid for the following items: • Push Button • Check box • List item • Radio group • Hierarchical tree item • Sound item • Custom item ................................................ Oracle Forms Developer: Build Internet Applications I 19-9 ................................Bean Area Setting Yes No Use to Ensure That Form Builder navigates to the new item which causes the relevant navigational and validation triggers to fire Form Builder does not navigate to the new item or validate the existing item when the user activates the new item with the mouse Note: The default setting for the Mouse Navigate property is Yes....OLE2 Container .................ActiveX Control ................................................................... Mouse Navigate Property The Mouse Navigate property applies only to mouse-driven applications...................................Controlling Navigation ......................... .................................................

. Internal Navigation Exit item ^ x Next Record Exit record v Enter record Enter item Copyright  Oracle Corporation................. All rights reserved.................................................................... Instructor Note Draw navigation examples of “on entry” and “on commit............................................................... 2000.............Lesson 19: Navigation .................” PRE-FORM PRE-BLOCK PRE-RECORD PRE-TEXT-ITEM POST-TEXT-ITEM POST-RECORD POST-BLOCK ........................................................................................... 19-10 Oracle Forms Developer: Build Internet Applications I ...................................

.......................... You do not see the internal navigation events that must occur for the input focus to enter the first item............Understanding Internal Navigation .................. This logical navigation is also known as internal navigation............. and deletes to the database............... You have seen that navigation involves changing the location of the input focus on the screen. some logical navigation takes place............................ Example When you enter a form module. In addition to the visible navigation that occurs.......... you see the input focus in the first enterable item of the first navigation block............................. These internal navigation events are as follows: • Entry to form • Entry to block • Entry to record • Entry to item Example When you commit your inserts....................................................................................... updates................ Understanding Internal Navigation Navigation occurs when the user or a trigger causes the input focus to move to another object................. However. internally the following navigation events must occur before commit processing begins: • Exit current item • Exit current record • Exit current block .... Oracle Forms Developer: Build Internet Applications I 19-11 ........................... you do not see the input focus moving.........

.............and Post- When-New-“object”-Instance Fire during navigation Fire after navigation Does not fire if validation unit is higher than trigger object Does fire when validation unit is higher than the trigger object Allow unrestricted built-ins Allow restricted and unrestricted built-ins Handle failure by returning to initial object Are not affected by failure Copyright  Oracle Corporation................................ 2000........................................ 2000............................ 19-12 Oracle Forms Developer: Build Internet Applications I ................................................................ Navigation Triggers ^ x Pre. Navigation Triggers Pre...........and Post- v When-New-“object”-Instance Copyright  Oracle Corporation........ All rights reserved...... ................................................................................Lesson 19: Navigation . All rights reserved.........................

.................. Example The Pre-Text-Item trigger fires just before entering a text item. if the validation unit is Record............. Failure of a navigation trigger can cause a fatal error to your form.....Navigation Triggers ...... the input focus returns to its initial location (where it was prior to the trigger firing)..........................................navigation triggers fire during navigation.. Pre....or Post-navigation trigger fails......... Note: Be sure that Pre..and Post-navigation triggers display a message on failure.......and Post............................and Post-Navigation Triggers Fire? The Pre......... failure of Pre-Form.............. or Pre-Text-Item on entry to the form will cancel execution of the form..... Oracle Forms Developer: Build Internet Applications I 19-13 ........... What Happens When a Navigation Trigger Fails? If a Pre............ When Do Navigation Triggers Not Fire? The Pre.........................................navigation triggers • When-New-“object”-Instance triggers When Do Pre... it appears that the input focus has not moved at all....and Post..and Post-navigation triggers do not fire if they belong to a unit that is lower in the hierarchy than the current validation unit............. When Do When-New-“object”-Instance Triggers Fire? The When-New-“object”-Instance triggers fire immediately after navigation to the object specified as part of the trigger name....and Post-Text-Item triggers do not fire..... For instance.................................... For example.. .... To the user........ Navigation Triggers The navigation triggers can be subdivided into two general groups: • Pre.. that is just before entry to or just after exit from the object specified as part of the trigger name..... Pre-Block........ Pre-Record.. Example The When-New-Item-Instance trigger fires immediately after navigation to a new instance of an item...

................. 2000.. ’S_ITEM’)............. SET_RECORD_PROPERTY(3.................. 2000................................ ORDER_BY............ ICON_NAME..... SET_ITEM_PROPERTY(’CONTROL.... ’S_ITEM’. SET_“object”_PROPERTY Examples SET_FORM_PROPERTY(FIRST_NAVIGATION_BLOCK. ’stock’)................. ’CUSTOMER_ID’)............. QUERY_STATUS).. When-New-“object”-Instance Triggers • • • • When-New-Form-Instance When-New-Block-Instance When-New-Record-Instance When-New-Item-Instance Copyright  Oracle Corporation.... ’stock’).... SET_ITEM_PROPERTY(’CONTROL... ICON_NAME... SET_RECORD_PROPERTY(3.......... ’S_ITEM’.............. All rights reserved.Lesson 19: Navigation ....................... SET_BLOCK_PROPERTY(’S_ORD’... SET_FORM_PROPERTY(FIRST_NAVIGATION_BLOCK.. STATUS..........stock_button’.... STATUS................ QUERY_STATUS)........................ All rights reserved.... ’S_ITEM’)........................... 19-14 Oracle Forms Developer: Build Internet Applications I ......... Copyright  Oracle Corporation....................... ........stock_button’.

...................... along with the SET_“object”_PROPERTY built-in subprograms to initialize Form Builder objects.......................... Oracle Forms Developer: Build Internet Applications I 19-15 ......... Using the When-New-“object”-Instance Triggers If you include complex navigation paths through your application. after successful navigation into a form After successful navigation into a block After successful navigation into the record After successful navigation to a new instance of the item Initializing Form Builder Objects Use the When-New-“object”-Instance triggers................. Example Perform a query of all orders............................ PROPERTY_FALSE)............ IF GET_APPLICATION_PROPERTY(username) = ’SCOTT’ THEN SET_BLOCK_PROPERTY(’S_ITEM’....... record.................... or item................. Example The following example of a When-New-Block-Instance trigger conditionally sets the DELETE ALLOWED property to FALSE.............. END IF................................... you may want to check or set initial conditions when the input focus arrives in a particular block.DELETE_ALLOWED. .................... when the ORDERS form is run... by including the following code in your When-New-Form-Instance trigger: EXECUTE_QUERY....................Using the When-New-“object”-Instance Triggers ............................. These triggers are particularly useful if you conditionally require a default setting............................. Use the following triggers to do this: Trigger When-New-Form-Instance When-New-Block-Instance When-New-Record-Instance When-New-Item-Instance Fires Whenever Form Builder runs a form......

.............stock_button’.... .................................Lesson 19: Navigation ...stock_button’............. enabled.........................and Post-Triggers • • • • Pre/Post-Form Pre/Post-Block Pre/Post-Record Pre/Post-Text-Item Copyright  Oracle Corporation.... All rights reserved............ enabled............. The Pre........................................... All rights reserved.......... property_false)....................................................... 2000........... 2000.. Post-Block Trigger Example Disabling Stock_Button when leaving the S_ITEM block: SET_ITEM_PROPERTY(’CONTROL...... property_false)....... 19-16 Oracle Forms Developer: Build Internet Applications I .................. SET_ITEM_PROPERTY(’CONTROL........................ Copyright  Oracle Corporation.................... Instructor Note Ask the students what type of trigger you would use reenable the Stock_Button.

.

.....................fmb file contains navigation triggers defined at the form level.. a message displays.. Instructor Note Demonstration The navigation........ As each navigation trigger fires............................................................................... The Navigation Trap ^ A Post-Text-Item Pre-Text-Item v B Pre-Text-Item Copyright  Oracle Corporation.............................. Run the file................................... 2000.. Use this demonstration to explain navigation triggers and the potential navigation trap......................... click the Display Messages check box.............Lesson 19: Navigation ............................................................ and navigate through the form... ............. All rights reserved....... 19-18 Oracle Forms Developer: Build Internet Applications I ............

...................................... Note: Be sure to code against navigation trigger failure. The Navigation Trap You have seen that the Pre.............. and when they fail the internal cursor attempts to return to the current item (SYSTEM....navigation trigger fails and attempts to return the logical cursor to its initial item.or Post.............. and a fatal error occurs......................... ........... Oracle Forms Developer: Build Internet Applications I 19-19 ... if the initial item has a Pre-Text-Item trigger that also fails the cursor has nowhere to go.....CURSOR_ITEM)..................................... The diagram on the opposite page illustrates the navigation trap..................... This can occur when a Pre........................................................................ However......and Post.................navigation triggers fire during navigation...........................................The Navigation Trap ..

.........date_shipped’............... UPDATE_ALLOWED......... • Pre-Text-Item IF IF CHECKBOX_CHECKED(’S_ORD.. IF....... GO_ITEM(’S_ORD............ property_false)...................... GO_ITEM(’S_ORD.........order_filled’) CHECKBOX_CHECKED(’S_ORD.. Copyright  Oracle Corporation........................ whereas the second incorrectly uses the Pre-Text-Item trigger and contains a restricted built-in... 2000...........................date_shipped’....date_shipped’.................. END IF........... SET_ITEM_PROPERTY(’S_ORD.........order_filled’)THEN SET_ITEM_PROPERTY(’S_ORD.........................date_shipped’)......... UPDATE_ALLOWED...........Lesson 19: Navigation ..................... property_false)...... All rights reserved........date_shipped’)....... 19-20 Oracle Forms Developer: Build Internet Applications I ............................... Navigation in Triggers • When-New-Item-Instance IF CHECKBOX_CHECKED(’S_ORD.. Instructor Note Point out that the first example correctly uses the When-New-Item-Instance trigger...... property_false).. UPDATE_ALLOWED... ....order_filled’) THEN THEN SET_ITEM_PROPERTY(’S_ORD..... END END IF.....

..........................................................Navigation in Triggers ...................................... Navigation in Triggers You can initiate navigation programmatically by calling the built-in subprograms. Built-in Routines for Navigation GO_FORM GO_BLOCK GO_ITEM GO_RECORD NEXT_BLOCK NEXT_ITEM NEXT_KEY NEXT_RECORD NEXT_SET UP DOWN PREVIOUS_BLOCK PREVIOUS_ITEM PREVIOUS_RECORD SCROLL_UP SCROLL_DOWN Function Navigates to an open form (in a multiple form application) Navigates to an indicated block Navigates to an indicated item Navigates to a specific record Navigates to the next enterable block Navigates to the next enterable item Navigates to the next enterable.............................................. primary key item Navigates to the first enterable item in the next record Fetches another set of records from the database and navigates to the first record that the fetch retrieves Navigates to the instance of the current item in the previous record Navigates to the instance of the current item in the next record Navigates to the previous enterable block Navigates to the previous enterable item Navigates to the previous record Scrolls the block so that the records above the top visible one display Scrolls the block so that the records below the bottom visible one display .......................................................... such as GO_ITEM and PREVIOUS_BLOCK from triggers............................................................ Oracle Forms Developer: Build Internet Applications I 19-21 ...........................................

............................................................. ................................................ Summary • • • Controlling navigation through properties Internal navigation Navigation triggers – When-New-“object”-Instance – Pre– Post- • • Navigation trap Navigation in triggers Copyright  Oracle Corporation................................... 2000............................................... 19-22 Oracle Forms Developer: Build Internet Applications I ....................................................................Lesson 19: Navigation ............. All rights reserved................................

........When-New-“object”-Instance ........................................... • Navigation built-ins are available...........................Pre.......Item properties • Internal navigation events also occur.......and Post• Avoid the navigation trap............Data block properties ................ you learned at the different methods of forcing visible navigation and also the invisible events...................................... Oracle Forms Developer: Build Internet Applications I 19-23 .................................................................... • Navigation triggers: . • You can control navigation through the following properties: ...........................Summary . Summary In this lesson.............................................Form module properties .... ........

........ 2000..............” ..........................Lesson 19: Navigation .............. Practice 19 Overview This practice covers the following topics: • • Executing a query at form startup Populating product images when cursor arrives on each record of the S_ITEM block Copyright  Oracle Corporation....................... “Practice Solutions................ see Practice 19 in Appendix A........................................................ All rights reserved....................................................................................................... 19-24 Oracle Forms Developer: Build Internet Applications I ................. Note For solutions to this practice..............................

............................. you provide a trigger to automatically perform query at form startup............... Also................................................. • Executing a query at form startup • Populating product images when the cursor arrives on each record of the S_ITEM block ..............Practice 19 Overview ... Practice 19 Overview In this practice.................................................................................................................................................... you use When-New-“object”-Instance triggers to populate the Product_Image item as the operator navigates between records in the ORDGXX form............................ Oracle Forms Developer: Build Internet Applications I 19-25 ...................

.filename INTO v_filename FROM s_image... If the function returns a usable filename...... the function returns “No file.....................................................................” FUNCTION get_product_image (product_number IN NUMBER) RETURN VARCHAR2 IS v_filename VARCHAR2(20)....... 19-26 Oracle Forms Developer: Build Internet Applications I .. Use Get_Product_Image function for this purpose........................... IF v_filename is null THEN v_filename := ’No file’.....id = s_product........... This will display the image for the first line item’s product if the operator changes the displayed order... EXCEPTION WHEN no_data_found THEN return(’No file’). Deploy the form on the Web to test. if one exists.......................... Use the EXECUTE_QUERY built-in... Practice 19 1 Write a When-New-Form-Instance trigger on the ORDGXX form to execute a query at form startup...............image_id AND s_product......... RETURN v_filename.. END IF...... s_product WHERE s_image.................Lesson 19: Navigation . Get_Product_Image function is already created for you....... .. This function returns the image file name for the given product number.... If a file is not found... BEGIN SELECT s_image..................id = product_number......... END.... your trigger should pass this name to the READ_IMAGE_FILE built-in.......... 4 Is there another trigger where you might also want to place this code? 5 Save and compile the form........... 2 Write a trigger that fires as the cursor arrives in each record of the S_ITEM block................ 3 Define the same trigger type and code on the S_ORD block................ and populate the Product_Image item with a picture of the product..............

................... Transaction Processing ..........20 ....

.............................................................................................................. Schedule Topic Lecture Practice Total Timing 90 minutes 30 minutes 120 minutes ....................... you should be able to do the following: • Describe details of commit processing and commit triggers • Supplement transaction processing by using triggers • Allocate sequence numbers to records as they are applied to tables • Implement array DML Copyright  Oracle Corporation...........................Lesson 20: Transaction Processing ............................................................................... 20-2 Oracle Forms Developer: Build Internet Applications I ........... All rights reserved.................... 2000.............. Objectives After completing this lesson.....................

... .................Introduction ............................................. Form Builder enables you to make triggers fire in order to alter or add to the default behavior....................................................... Oracle Forms Developer: Build Internet Applications I 20-3 ............................................................................................. Introduction Overview While applying a user’s changes to the database.... This lesson shows you how to build triggers that can perform additional tasks during this stage of a transaction.......................................................................................

.............. work..........Lesson 20: Transaction Processing . 2000...... All rights reserved..................................................................................................................... 20-4 Oracle Forms Developer: Build Internet Applications I ..... ........................................................................................ Transaction Processing FORM A Action Edit Transaction (Begin) Save Block#1 INSERT INSERT INTO INTO Table1 Table1 New Record Updated Record UPDATE UPDATE Table1 Table1 Block#2 Updated Record DELETE DELETE FROM FROM Table2 Table2 Deleted Record UPDATE UPDATE Table2 Table2 Transaction (End) Commit Commit work............................ Copyright  Oracle Corporation.....................................

.......... UPDATE........ Commit This performs the database commit.... making the changes permanent..... a process takes place involving events in the current database transaction...... Post Posting writes the user’s changes to the base tables....... Transactional triggers fire during this cycle if defined by the designer...... using implicit INSERT............................ and DELETE statements generated by Form Builder. followed by inserts and updates. In either case........... • The COMMIT_FORM built-in procedure is called from a trigger... making the applied changes permanent and releasing locks............... Oracle Forms Developer: Build Internet Applications I 20-5 ........................................... deletes are performed first............Transaction Processing .. the process involves two phases... The changes are applied in block sequence order as they appear in the Object Navigator at design time......... This process includes: • Default Form Builder transaction processing: Applies the user’s changes to the base tables • Firing transactional triggers: Needed to perform additional or modified actions in the saving process defined by the designer When all of these actions are successfully completed................ or clicks on the Save button on the default Form toolbar..................... What Happens in Transaction Processing? The transaction process occurs as a result of either of the following actions: • The user presses Save or selects Action—>Save from the menu.......... Transaction Processing When Form Builder is asked to save the changes made in a form by the user....... For each block....................... The built-in procedure POST alone can invoke this posting process......................... ............. Form Builder commits the transaction........... posting and committing........................

......................................Lesson 20: Transaction Processing ..................................... All rights reserved.............................................................................................. .................................................. 2000...... 20-6 Oracle Forms Developer: Build Internet Applications I ............................................................ Transaction Processing Transaction processing includes two phases: • Post: – Writes record changes to base tables – Fires transactional triggers • Commit: Performs database commit Errors result in: • • Rollback of the database changes Error message Copyright  Oracle Corporation...................

................. Locks also apply during the posting phase of a transaction. If encountered in a client-side program unit................. Rollbacks Form Builder will roll back applied changes to a savepoint if an error occurs in its default processing............... Locking When you update or delete base table records in a form application...................................Transaction Processing . Note: The SQL statements COMMIT................................. and a failing insert or update results in the record being redisplayed....... database locks are automatically applied............. ROLLBACK..... can request a rollback to the latest savepoint by using the TO_SAVEPOINT option... Savepoints Form Builder issues savepoints in a transaction automatically..... .................... Generally....... Oracle Forms Developer: Build Internet Applications I 20-7 ..... The user can then attempt to correct the error before trying to save again...... and will roll back to the latest savepoint if certain events occur...... or when a transactional trigger fails....... and ROLLBACK as the CLEAR_FORM built-in... and SAVEPOINT cannot be called from a trigger directly........ and for DML statements that you explicitly use in your code....... the user is informed of the error through a message...... but certain built-ins..................................................... such as the EXIT_FORM built-in procedure............. By default... these savepoints are for Form Builder internal use................... Form Builder treats COMMIT as the COMMIT_FORM built-in.........

.................................................Lesson 20: Transaction Processing .................................. 2000...................... All rights reserved........... .......................................................................... 20-8 Oracle Forms Developer: Build Internet Applications I ......................................................................................................... Copyright  Oracle Corporation.........

....... For all inserted or updated records of the block in sequential order: If it is an inserted record: ............. 3 Fire the Pre-Commit trigger..................Fire the Post-Delete trigger. 5 Fire the Post-Forms-Commit trigger.Check the record uniqueness .........Copy Value From Item....... 7 Fire the Post-Database-Commit trigger............. The Commit Sequence of Events The commit sequence of events (when the Array DML size is 1) is as follows: 1 Validate the form........ ..... .....Check the record uniqueness...... then: 6 Issue an SQL-COMMIT statement..........Insert the row into the base table or fire the On-Insert trigger................. Oracle Forms Developer: Build Internet Applications I 20-9 ........... 4 Validate the block (for all blocks in sequential order)...Update the row in the base table or fire the On-Update trigger. If it is an updated record: .... 2 Process savepoint....... ................Fire the Post-Update trigger...... ........The Commit Sequence of Events ..................... ............................. ..........Fire the Post-Insert trigger.................................Fire the Pre-Delete trigger... ....... ......... For all deleted records of the block (in reverse order of deletion): ..Delete the row from the base table or fire the On-Delete trigger....... ..Fire the Pre-Insert trigger........................... If the current operation is COMMIT.....Fire the Pre-Update trigger.

................ Copyright  Oracle Corporation...................... All rights reserved.................. UPDATE_RECORD built-ins Copyright  Oracle Corporation.. Characteristics of Commit Triggers • Pre-Commit: Fires once if form changes are made or uncommitted changes are posted • • Pre.........................................................and Post-DML On-DML: Fires per record........... ........................................................... All rights reserved. replacing default DML on row Use DELETE_RECORD........Lesson 20: Transaction Processing .. 20-10 Oracle Forms Developer: Build Internet Applications I ................. 2000.................................. Characteristics of Commit Triggers • Post-Forms-Commit: Fires once even if no changes are made • Post-Database-Commit: Fires once even if no changes are made Note: A commit-trigger failure causes a rollback to the savepoint.................................... INSERT_RECORD.... 2000.........................

......) Note: If a commit trigger—except for the Post-Database-Commit trigger—fails.. after the SQL-COMMIT statement is issued...Characteristics of Commit Triggers ........... not yet committed posts are not rolled back............. ..... or delete when Forms would typically issue its INSERT.... This also means that earlier....) Fire for each record that is marked for insert..................... or deleted in the database Fires for each record that is marked for insert................... after base table blocks are processed but before the SQL-COMMIT statement is issued...... Characteristics of Commit Triggers You have already seen when commit triggers fire during the normal flow of commit processing.............................. the transaction is rolled back to the savepoint that was set at the beginning of the current commit processing............. even fires if there are no changes to commit (This is also true for the SQL-COMMIT statement itself.............. or DELETE statement (These triggers replace the DML statements...... update............... or DELETE_RECORD built-in to perform the default processing for these triggers....................... UPDATE_RECORD.... UPDATE............. even fires if there are no changes to post or commit..... Trigger Pre-Commit Pre.................... fires if there are changes to base table items in the form or if changes have been posted but not yet committed (This trigger always fires in case of uncommitted posts.. Fires once during commit processing..... before base table blocks are processed.......... Oracle Forms Developer: Build Internet Applications I 20-11 . updated...... or delete........ Include a call to the INSERT_RECORD.... update...................and Post-DML On-DML Post-Forms-Commit Post-Database-Commit Characteristic Fires once during commit processing...........) Fires once during commit processing... just before or after the row is inserted.. even if there are no changes to post............. The following table gives more detailed information regarding the conditions under which these triggers fire..........

............ test uncommitted posts Copyright  Oracle Corporation.................Lesson 20: Transaction Processing ... 2000........................... Commit Triggers Uses On-Insert/Update/Delete Replace default block DML statements Post-Forms-Commit Check complex multirow constraints Post-Database-Commit Test commit success............................................... All rights reserved......................................... All rights reserved................................... Commit Triggers Uses Pre-Commit Check user authorization.......... ...... implement foreign-key delete rule Pre-Insert Generate sequence numbers........... implement foreign-key update rule...... set up special locking Pre-Delete Journaling.. check constraints Copyright  Oracle Corporation.......... automatically generated columns......... check constraints Pre-Update Journaling................ auto-generated columns................... journaling....... 2000........... 20-12 Oracle Forms Developer: Build Internet Applications I ...........................

.

.................................. ............................................. All rights reserved.................................................................. 20-14 Oracle Forms Developer: Build Internet Applications I ................................................................................ Life of an Update Query Item 20 Column Rollback Locked Data 20 30 20 [Save] 30 20 Pre-Update 30 20 Row Updated updated 30 30 20 Post-Update 30 30 20 Update record in form Commit 30 30 Copyright  Oracle Corporation................................................................ 2000...Lesson 20: Transaction Processing ............

.

........ ELSE CLOSE C1............ A global variable exists for the session..... ...................... MESSAGE(’There are orders for this customer!’).................. END. 20-16 Oracle Forms Developer: Build Internet Applications I .............................dummy......................... RAISE form_trigger_failure......... IF C1%FOUND THEN CLOSE C1................... Instructor Note In the example above.... a PL/SQL variable ceases to exist............... BEGIN OPEN C1.......... Copyright  Oracle Corporation................. 2000. When the block terminates............Lesson 20: Transaction Processing .......... All rights reserved........ END IF................... a local PL/SQL variable could be used rather than a global variable................ Delete Validation • • Pre-Delete trigger Final checks before row deletion DECLARE CURSOR C1 IS SELECT ’anything’ FROM S_ORD WHERE customer_id = :S_CUSTOMER............................................ FETCH C1 INTO :GLOBAL.id...............

.

........................................................................................id SYS........ SYS....................id :S_ORD..........Lesson 20: Transaction Processing ................................................ 2000.................. • Generate and run to show effects.........dual............ 20-18 Oracle Forms Developer: Build Internet Applications I ................... Instructor Note Demonstration In the demonstration form that you are building: • Create the Pre-Insert trigger.dual...... All rights reserved................ shown above...nextval :S_ORD.... Insert Pre-Insert ID 601 6 60 Value Value 01 2 Database 602 Sequence Copyright  Oracle Corporation...... Assigning Sequence Numbers SELECT SELECT INTO INTO FROM FROM S_ORD_ID. noting that the assigned sequence number appears when the new record is saved....................nextval S_ORD_ID................ in the S_ORD block..... .......

.

............................................ Copyright  Oracle Corporation....insert_tot)+1)...........................................insert_tot)+1)................Lesson 20: Transaction Processing ............. 2000.......................insert_tot := := TO_CHAR(TO_NUMBER(:GLOBAL.................... TO_CHAR(TO_NUMBER(:GLOBAL........................................... Keeping an Audit Trail • • Write changes to nonbase tables................ Post-Insert example: :GLOBAL... 20-20 Oracle Forms Developer: Build Internet Applications I ............. All rights reserved............................insert_tot :GLOBAL... Gather statistics on applied changes................................. ..........

...Common Uses for Commit Triggers ....... who_did_it) VALUES ( :S_ORD... or recording statistics each time a DML operation occurs.. If the base table changes are committed at the end of the transaction.insert_tot := TO_CHAR(TO_NUMBER(:GLOBAL........................... timestamp............................................ Oracle Forms Developer: Build Internet Applications I 20-21 ......... USER )... Keeping an Audit Trail You may want to use the Post event transactional triggers to record audit information about the changes applied to base tables.................................................................................... along with a time stamp and the user who performed the update................ .... this may involve duplicating inserts or updates in backup history tables................. INSERT INTO update_audit (id.. In some cases........... Example This Post-Insert trigger adds to a running total of Inserts for the transaction.......... :GLOBAL.............. SYSDATE.... which is recorded in the global variable INSERT_TOT........................id............... the audit information will also be committed.........insert_tot)+1)....... Example This Post-Update trigger writes the current record ID to the UPDATE_AUDIT table....

............... RAISE form_trigger_failure.... 2000...................................... Testing the Result of Trigger DML • • • SQL%FOUND SQL%NOTFOUND SQL%ROWCOUNT UPDATE S_ORD SET date_shipped = SYSDATE WHERE id = :S_ORD.................Lesson 20: Transaction Processing ..........id............................................................................... END IF........ Copyright  Oracle Corporation....... ............ IF SQL%NOTFOUND THEN MESSAGE(’Record not found in database’).......................... All rights reserved............................. 20-22 Oracle Forms Developer: Build Internet Applications I ................................................................

.

....................... Copyright  Oracle Corporation.................. base_column = :base_item.............. base_column. • Locking statements are not issued......... DML Statements Issued During Commit Processing INSERT INTO base_table VALUES UPDATE SET WHERE (base_column................................... .........................Lesson 20: Transaction Processing ....) (:base_item....... :base_item. The Update Changed Columns Only and Enforce Column Security properties affect UPDATE statements.... All rights reserved............. 2000......) base_table base_column = :base_item... DML Statements Issued During Commit Processing Rules: • • • DML statements may fire database triggers............................. 2000........... ........................ Form Builder uses and retrieves ROWID............. ........ 20-24 Oracle Forms Developer: Build Internet Applications I .................................................... All rights reserved....................... ROWID = :ROWID DELETE FROM base_table WHERE ROWID = :ROWID Copyright  Oracle Corporation...

.

........ ............................................ Overriding Default Transaction Additional transactional triggers: Trigger Do-the-Right-Thing Built-in On-Check-Unique CHECK_RECORD_UNIQUENESS On-Column-Security ENFORCE_COLUMN_SECURITY On-Commit COMMIT_FORM On-Rollback ISSUE_ROLLBACK On-Savepoint ISSUE_SAVEPOINT On-Sequence-Number GENERATE_SEQUENCE_NUMBER Copyright  Oracle Corporation................. All rights reserved.... Instructor Note The above transactional triggers are meant to be used when connecting to data sources other than Oracle............. 2000.............. 20-26 Oracle Forms Developer: Build Internet Applications I .........Lesson 20: Transaction Processing ....................................................................................................................................................................................................

................................ Oracle Forms Developer: Build Internet Applications I 20-27 ...................................................................................... Additional Transactional Triggers for Commit Processing Trigger On-Check-Unique On-Column-Security On-Commit On-Rollback On-Savepoint On-Sequence-Number Do-the-Right-Thing Built-in CHECK_RECORD_UNIQUENESS ENFORCE_COLUMN_SECURITY COMMIT_FORM ISSUE_ROLLBACK ISSUE_SAVEPOINT GENERATE_SEQUENCE_NUMBER ........................................................................... Other examples include triggers that fire during logon and logout or during queries performed on the data source.........................Overriding Default Transaction Processing ...... Transactional Triggers All triggers that are related to accessing a data source are called transactional triggers.............................. Overriding Default Transaction Processing You have already seen that some commit triggers can be used to replace the default DML statements that Form Builder issues during commit processing....................................... Commit triggers form a subset of these triggers............ You can use several other triggers to override the default transaction processing of Form Builder.

........................ but those covered on this and the previous slides are the most important................................. 20-28 Oracle Forms Developer: Build Internet Applications I ............................................................... Instructor Note There are more transactional triggers......Lesson 20: Transaction Processing .................................................. ................ 2000................. All rights reserved.................. Overriding Default Transaction Transactional triggers for logging on and off: Trigger Do-the-Right-Thing Built-in Pre-Logon - Pre-Logout - On-Logon LOGON On-Logout LOGOUT Post-Logon - Post-Logout - Copyright  Oracle Corporation...............................................................................

...................................................................................................... Oracle Forms Developer: Build Internet Applications I 20-29 . • The logon and logoff transactional triggers can also be used with Oracle databases to change connections at run time................. . Transactional Triggers for Logging On and Off Trigger Pre-Logon Pre-Logout On-Logon On-Logout Post-Logon Post-Logout Do-the-Right-Thing Built-in LOGON LOGOUT - Uses for Transactional Triggers • Transactional triggers........................................................Overriding Default Transaction Processing ...... are primarily intended to access certain data sources other than Oracle................................................................................................. except for the commit triggers.........................

..... 20-30 Oracle Forms Developer: Build Internet Applications I ............................. ................................. All rights reserved......................................... Running with Data Sources Other than Oracle • Connecting with Open Gateway: – Cursor and Savepoint mode form module properties – Key mode and Locking mode block properties • Using transactional triggers: – Call 3GL programs – Database data block property Copyright  Oracle Corporation.........................Lesson 20: Transaction Processing ................. 2000....... Running with Data Sources Other than Oracle • Three ways to run against data sources other than Oracle: – Oracle Open Gateways – Oracle Open Client Adapter for ODBC – Write appropriate transactional triggers Copyright  Oracle Corporation............................................. 2000................................................................................................ All rights reserved.........

....... you should be aware of these transactional properties: • Cursor mode form module property • Savepoint mode form module property • Key mode block property • Locking mode block property You can set these properties to specify how Form Builder should interact with your data source.. Connecting with Open Gateway When you connect to a data source other than Oracle with an Open Gateway product............... Setting this property to Yes ensures that transactional triggers will fire for the block... you must call 3GL programs that implement the access to the data source..... ................. that is.. a control block that should be treated as a base table block....................... you must define transactional triggers.................Running Against Data Sources Other than Oracle . • Write the appropriate set of Transactional triggers. Running Against Data Sources Other than Oracle Three Ways to Run Against Data Sources Other than Oracle • Use Oracle Open Gateway products................................. • Use Oracle Open Client Adapter for ODBC. otherwise you will get an error during form generation.... The specific settings depend on the capabilities of the data source.. Oracle Forms Developer: Build Internet Applications I 20-31 .............................. Database Data Block Property This block property identifies a block as a transactional control block............................. From these triggers....... Using Transactional Triggers If no Open Gateway or Open Client Adapter drivers exist for your data source....... you must define all On-Event transactional triggers...... If you set this property to Yes............................................................................... even though it is not a base table block............................

.................. 20-32 Oracle Forms Developer: Build Internet Applications I ........................ .................................................................. Getting and Setting the Commit Status • • What is commit status? SYSTEM....Lesson 20: Transaction Processing ...................................... 2000............................... All rights reserved.............................................................................................................RECORD_STATUS: – NEW – INSERT (also caused by control items) – QUERY – CHANGED Copyright  Oracle Corporation...............

.......................................... The Four Values of SYSTEM... the record status also becomes INSERT..........Getting and Setting the Commit Status .. Note that when you change a control item of a NEW record............................. see below................... but that none of its items have been changed yet (The record may have been populated by default values............................. and so on....RECORD_STATUS Value NEW INSERT QUERY CHANGED Description Indicates that the record has been created.............. it is often useful to know if the record is in the database or if it has been changed.) ...... You can use system variables and built-ins to obtain this information..................................) Indicates that one or more of the items in a newly created record have been changed (The record will be processed as an insert during the next commit process if its block has the CHANGED status........... Getting and Setting the Commit Status If you want to process a record in your form................................ or not processed at all........ For example....... but that none of its base table items have been changed Indicates that one or more base table items in a database record have been changed (The record will be processed as an update (or delete) during the next commit process. Oracle Forms Developer: Build Internet Applications I 20-33 ....) Indicates that the record corresponds to a row in the database........ the record can be inserted............................................. What Is the Commit Status of a Record? The commit status of a record of a base table block determines how the record will be processed during the next commit process... updated.......

................................BLOCK_STATUS: – NEW (may contain records with status INSERT) – QUERY (also possible for control block) – CHANGED (block will be committed) Copyright  Oracle Corporation.... Getting and Setting the Commit Status • SYSTEM.......................... All rights reserved............ Getting and Setting the Commit Status • SYSTEM......... 20-34 Oracle Forms Developer: Build Internet Applications I .......... 2000......................................................................... ...Lesson 20: Transaction Processing .....................................................FORM_STATUS: – NEW – QUERY – CHANGED Copyright  Oracle Corporation..... All rights reserved........... 2000.......................................................................

.............) Three Values of SYSTEM.........BLOCK_STATUS Value NEW QUERY CHANGED Description Indicates that all records of the block have the status NEW (Note that a base table block with the status NEW may also contain records with the status INSERT caused by changing control items).FORM_STATUS Value NEW QUERY CHANGED Description Indicates that all blocks of the form have the status NEW Indicates that at least one block of the form has status QUERY and all other blocks have the status NEW Indicates that at least one block of the form has the status CHANGED ...) Indicates that the block contains at least one record with the status INSERT or CHANGED if the block is a base table block (The block will be processed during the next commit process................................................................................................Getting and Setting the Commit Status ............................................................ Three Values of SYSTEM.... Note that a control block cannot have the status CHANGED.............................................................. Indicates that all records of the block have the status QUERY if the block is a base table block (A control block has the status QUERY if it contains at least one record with the status INSERT.......................................................... Oracle Forms Developer: Build Internet Applications I 20-35 .

................................. All rights reserved............... ................................ 2000.............................. 2000. Copyright  Oracle Corporation.......................................... All rights reserved...... 20-36 Oracle Forms Developer: Build Internet Applications I ........................ • Warnings: – Do not confuse commit status with validation status.. Getting and Setting the Commit Status • Example: If the third record of block S_ORD is a changed database record.............Lesson 20: Transaction Processing ....................... Getting and Setting the Commit Status • System variables versus built-ins for commit status • Built-ins for getting and setting commit status: – GET_BLOCK_PROPERTY – GET_RECORD_PROPERTY – SET_ RECORD _PROPERTY Copyright  Oracle Corporation.................................. – The commit status is updated during validation...................... set the status back to QUERY..................................

....... BEGIN IF GET_RECORD_PROPERTY(3................... INSERT_STATUS QUERY_STATUS CHANGED_STATUS Example If the third record of the S_ORD block is a changed database record............ END IF........ ’S_ORD’..... Use the STATUS property to obtain the record status of the specified record in the specified block............ END... .... Built-in GET_BLOCK_PROPERTY GET_RECORD_PROPERTY SET_RECORD_PROPERTY Description Use the STATUS property to obtain the block status of the specified block......................RECORD_STATUS and SYSTEM............ query_status).................... set the status back to QUERY.......................... status......... You can use built-ins to obtain the status of other blocks and records.................. Using Built-ins to Get the Commit Status The system variables SYSTEM........... Oracle Forms Developer: Build Internet Applications I 20-37 ................................ ’S_ORD’..............................status)= ’CHANGED’ THEN SET_RECORD_PROPERTY(3........... Set the STATUS property of the specified record in the specified block to one of the following constants: • • • NEW_STATUS............................Getting and Setting the Commit Status ........................BLOCK_STATUS apply to the record and block where the cursor is located.....

........ 20-38 Oracle Forms Developer: Build Internet Applications I ............................ delete Fires for each insert. delete PREFires DML DML POST- POSTFires Array DML Size = 1 Fires for each insert.......... Effect of Array DML on Transactional Triggers PRERepeated for each insert...... update............................................... update......... delete Array DML Size > 1 Copyright  Oracle Corporation. All rights reserved............................................ Array DML • • Performs array inserts............................. updates..... ..................................... 2000............. and deletes Vastly reduces network traffic Empno Ename Job Hiredate Fewer round trips (exact number depends on array size) 1234 Jones Clerk 01-Jan-1995 2 inserts 1235 Smith Clerk 01-Jan-1995 2 updates 1236 Adams Clerk 01-Jan-1995 1 delete 1237 Clark Clerk 01-Jan-1995 Database Copyright  Oracle Corporation.......... All rights reserved..... 2000....................Lesson 20: Transaction Processing ....................................... update...

.. and subqueries.. and the Post. .... reducing network traffic and thereby increasing performance. There is a point of diminishing return.. If you write On-DML triggers.............. For both querying and DML operations............... and deleted rows........ By enabling array processing........ you overwrite default transaction processing and cancel array processing. views.... changed. 5 arrays of 20 DML statements.......... Array processing is available for query and DML operations for blocks based on tables............ If you change 100 rows and DML Array Size is 20. Instructor Note Some students may ask why DML Array Size is not always set to a very large number....... the appropriate Pre......... With DML Array Size set to greater than 1... and all of the Post.. Oracle Forms Developer: Build Internet Applications I 20-39 ..................... a structure (an array) containing multiple records is sent to or returned from the server for processing..... and deleted record. The default behavior of Form Builder is to process records one at a time.trigger for that record fires....... you can determine the array size to optimize performance for your needs........... procedures....triggers fire for all of the new...............triggers. it is not supported for blocks based on transactional triggers.. you can process groups of records at a time...Array Processing ...... Array Processing Overview Array processing is an option in Form Builder that alters the way records are processed.. Pre-Update..... This lesson focuses on array DML processing....... and Pre-Delete triggers fire for each new. Effect of Array DML on Transactional Triggers With DML Array Size set to 1............ With array processing. you get 100 Pre... Form Builder supports both array fetch processing and array DML processing.. the DML is issued........... and 100 Post...................... all of the DML statements are issued.................... a large array size might result in records being broken into multiple packets. If each record is very large...................triggers... changed.. the Pre-Insert...........triggers fire........................................

............. Copyright  Oracle Corporation..................................Lesson 20: Transaction Processing ..................................... Specify a DML Array Size of greater than 1.............................................................. Implementing Array DML 1........... 3.................... 20-40 Oracle Forms Developer: Build Internet Applications I ...... Enable the Array Processing option...... 2000................................... .......... All rights reserved................... Specify block primary keys...... 2...................................................

.................. ..............................Array Processing ....................Under the Advanced Database category............ If you update a record in the same session that you inserted it...... ............ Oracle Forms Developer: Build Internet Applications I 20-41 ............In the Object Navigator......... You can also set this property programmatically...........Double-click the Data Blocks icon to display the Property Palette............. .. ............... How to Implement Array DML 1 To set preferences: ............ set the DML Array Size property to a number that represents the number of records in the array for array processing........................................... The Oracle server uses the ROWID to identify the row............................ Key mode can still be unique....................... you must specify the primary key......... 2 To set properties: .... Note: When the DML Array Size property is greater than 1.... ....Click the Runtime tab.. the server locks the record by using the primary key.. select the Data Blocks node. except after an array insert.....Select the Array Processing check box.................Select Tools—>Preferences.........

........................................ All rights reserved............................. ........................................... 2000................................................................................................................................. Summary • • • Post and commit phases • Characteristics and common uses of commit triggers • • • Overriding default transaction processing Flow of commit processing DML statements issued during commit processing Getting and setting the commit status Implementing Array DML Copyright  Oracle Corporation.................Lesson 20: Transaction Processing .. 20-42 Oracle Forms Developer: Build Internet Applications I ............................................

....System variables ...The Pre-Commit....The Pre-...................... • Overriding default transaction processing: . On-...... Update............... set up special locking requirements.......................... Post-Forms-Commit......Transactional On-Event triggers and “Do-the-Right-Thing” built-ins ........... ............. and Post-Database-Commit triggers fire once per commit process....Summary ........Post: Applies form changes to the base tables and fires transactional triggers ... ODBC.Built-ins • Array DML ......... Oracle Forms Developer: Build Internet Applications I 20-43 ........... or transactional triggers • Getting and setting the commit status: ... check complex constraints............UPDATE and DELETE statements use ROWID by default • Characteristics of commit triggers: ................... • Common uses for commit triggers: check authorization........ replace default DML statements issued by Form Builder..... and Post-Insert..............Based on base table items ............... Summary This lesson showed you how to build triggers that can perform additional tasks during the save stage of a current database transaction......................... • Transactions are processed in two phases: ........................ and Delete triggers fire once per processed record.... generate sequence numbers........... but consider uncommitted changes or posts..............Data sources other than Oracle use Open Gateway..............Commit: Commits the database transaction • Flow of commit processing • DML statements issued during commit processing: .............

.......................... 20-44 Oracle Forms Developer: Build Internet Applications I ............. 2000.................” ....................... “Practice Solutions.. see Practice 20 in Appendix A............................................................Lesson 20: Transaction Processing ........................................ Note For solutions to this practice.......... Practice 20 Overview This practice covers the following topics: • Automatically populating order IDs by using a sequence • Automatically populating item IDs by adding the current highest order ID • Customizing the commit messages in the CUSTOMERS form • Customizing the login screen in the CUSTOMERS form Copyright  Oracle Corporation......................................................................................... All rights reserved...........................

..... • Automatically populating order IDs by using a sequence • Automatically populating item IDs by adding the current highest order ID • Customizing the commit messages in the CUSTOMERS form • Customizing the login screen in the CUSTOMERS form ......................................................................................................................................... Practice 20 Overview In this practice..............................................................Practice 20 Overview .............................................. You also customize commit messages and the login screen in the CUSTGXX form................. Oracle Forms Developer: Build Internet Applications I 20-45 ...................... you add transactional triggers to the ORDGXX form to automatically provide sequence numbers to records at save time...............

.............UPDATE... Practice 20 1 In the ORDGXX form............. Post-Update... The unique ID for the order should appear when you save it.......... fail the trigger with a message..........Id with the next value from the S_ORD_ID sequence.. 6 Open the CUSTGXX form module................... Insert a new order.............. The better solution is to keep the total number of rows in another table that you can lock....... write a transactional trigger on the S_ORD block 2 3 4 5 that populates S_ORD............ Insert a new line-item record in the S_ITEM block..... and run the form to test.... Create a Pre-Insert trigger that assigns a value from this sequence... compile.... and Post-Delete triggers to initialize and increment the value of each global variable......... and GLOBAL.............. In the S_ORD block........... Instructor Note Solution 20:4 is not the safest way....................INSERT.......... and deletes.... 20-46 Oracle Forms Developer: Build Internet Applications I ... Perform the action in a Pre-Insert trigger... If an exception occurs in the trigger....... These variables indicate respectively the number of inserts.. Create a similar trigger on the S_ITEM block that assigns the Item_Id when a new record is saved. GLOBAL................. You need to write Post-Insert...... Derive this number by adding to the current highest Item_Id for the order........... but this solution is too advanced at this stage.................. Save.....................DELETE. .......... Set the Required and Enabled properties to No for Item_Id..Lesson 20: Transaction Processing ... set the Enabled property of the ID item to No... updates..... then save it............. Create three global variables called GLOBAL............ Save and compile the form. Deploy the form on the Web to test.........

......... Import the pr20_10....... END .. This procedure receives two arguments.....................................................Practice 20 . Write an On-Logon trigger to control the number of connection tries................... This procedure uses the three global variables to display a customized commit message and then erases the global variables. ’|| :GLOBAL.......update’ )......... ’|| :GLOBAL..delete || ’records deleted !!!’ )... DEFAULT_VALUE( ’0’..... IS_ERROR IN BOOLEAN ) IS BEGIN IF message_number IN ( 40400. ’GLOBAL........ You can import the pr20_11......... ELSE MESSAGE( MESSAGE_TEXT ).....delete’ )....... 40406.... Call the procedure when an error occurs.... ’GLOBAL................. Pass the error code and TRUE............ DEFAULT_VALUE( ’0’....... Practice 20 (continued) 7 Create a procedure called HANDLE_MESSAGE. The first one is a message number..... PROCEDURE handle_message( message_number IN NUMBER. Use the LOGON_SCREEN built-in to simulate the default login screen and LOGON to connect to the database..........txt file.. and the second is a Boolean error indicator. MESSAGE('Save Ok: ' || :GLOBAL. 40407 ) THEN DEFAULT_VALUE( ’0’............insert || ’records inserted... Oracle Forms Developer: Build Internet Applications I 20-47 ............. END IF..txt file......... ....... Call the procedure when a message occurs.... 8 Open the CUSTGXX form module............... Pass the message code and FALSE......insert’ )......................... ’GLOBAL....update || ’records updated... ELSIF is_error = TRUE THEN MESSAGE(’ERROR: ’|| ERROR_TEXT ).......................

. cs VARCHAR2(30)....... LOGON( un............................ pw VARCHAR2(30)....... END IF.......... WHILE connected = FALSE and tries > 0 LOOP LOGON_SCREEN...... cs := GET_APPLICATION_PROPERTY( CONNECT_STRING )...................... FALSE )........... On-Logon at Form Level DECLARE connected BOOLEAN := FALSE............... 20-48 Oracle Forms Developer: Build Internet Applications I .1........ END LOOP................................................ END............ BEGIN SET_APPLICATION_PROPERTY(CURSOR_STYLE............ tries NUMBER := 3............. IF FORM_SUCCESS THEN connected := TRUE .Lesson 20: Transaction Processing ........... .. IF NOT CONNECTED THEN MESSAGE(’Too many tries!’)..... ’DEFAULT’)...................... un := GET_APPLICATION_PROPERTY( USERNAME )...... RAISE FORM_TRIGGER_FAILURE...... tries := tries ........................ END IF..... pw := GET_APPLICATION_PROPERTY( PASSWORD )..... un VARCHAR2(30).................. pw || ’@’ || cs..................

.........21 .. Writing Flexible Code ......................

.......................... 2000.............. Objectives After completing this lesson.....................................................................................Lesson 21: Writing Flexible Code .......................... 21-2 Oracle Forms Developer: Build Internet Applications I ........................... Schedule Topic Lecture Practice Total Timing 50 minutes 30 minutes 80 minutes ... All rights reserved.......................................... you should be able to do the following: • • • Describe flexible code • • Write code to reference objects by internal ID State the advantages of using system variables Identify built-in subprograms that assist flexible coding Write code to reference objects indirectly Copyright  Oracle Corporation..................................................................................

........................................ ..................................................................................................................................... Introduction Overview Form Builder has a variety of features that enable you to write code in a flexible................. Oracle Forms Developer: Build Internet Applications I 21-3 .............................................................Introduction .................................................. reusable way..

........................ All rights reserved......................... .................................................. Flexible Code • • • • • Is reusable code Is generic code Avoids hard-coded object names Makes maintenance easier Increases productivity Copyright  Oracle Corporation................. 21-4 Oracle Forms Developer: Build Internet Applications I ....................................................................................................Lesson 21: Writing Flexible Code ...................................... 2000..................................................

..................................................... Why Write Flexible Code? Writing flexible code gives you the following advantages: • It is easier for you and others to maintain..... Flexible code is often generic code that you can use in any form module in an application.......................What Is Flexible Code? .......................................... What Is Flexible Code? Flexible code is code that you can use again..... It typically includes the use of system variables instead of hard-coded object names............................................................................................................................ .. Oracle Forms Developer: Build Internet Applications I 21-5 ....................... • It increases productivity.............................

............................... All rights reserved.....................CURSOR_VALUE Copyright  Oracle Corporation......................TRIGGER_BLOCK – SYSTEM........CURSOR_RECORD – SYSTEM.....CURSOR_ITEM – SYSTEM..................................... System Variables for Current Context • Input focus: – SYSTEM....................CURSOR_BLOCK – SYSTEM............................ All rights reserved............. 21-6 Oracle Forms Developer: Build Internet Applications I ........... 2000..........Lesson 21: Writing Flexible Code ....TRIGGER_RECORD – SYSTEM................. ...........................TRIGGER_ITEM Copyright  Oracle Corporation....... 2000..... System Variables for Current Context • Trigger focus: – SYSTEM................................................

.................................. System Variables for Locating Current Input Focus System Variable CURSOR_BLOCK CURSOR_RECORD CURSOR_ITEM CURSOR_VALUE Function Determines which block has the input focus Determines which record has the input focus Determines which item in which block has the input focus Determines the value of the item with the input focus System Variables for Locating Trigger Focus System Variable TRIGGER_BLOCK TRIGGER_RECORD TRIGGER_ITEM Function Determines the block that the input focus was in when the trigger initially fired Determines the number of the record that Form Builder is processing Determines the block and item that the input focus was in when the trigger initially fired Note: The best way to learn about system variables is to look at their values when a form is running......................................... and SYSTEM..................... SYSTEM....... and the form.0 and earlier) of Forms...CURRENT_BLOCK....CURRENT_FORM................. You can examine the system variables by using the Debugger............... Oracle Forms Developer: Build Internet Applications I 21-7 ................................................................................. SYSTEM........... Instructor Note SYSTEM................. you use the system variables that provide the current status of the record.... as well as system variables that return the current input focus location. the block............... Using System Variables for Flexible Coding In this lesson........... .........CURRENT_ITEM.CURRENT_VALUE are included for compatibility with earlier versions (version 3.......Using System Variables for Flexible Coding .................

..... Copyright  Oracle Corporation. GO_BLOCK(’S_ORD’)..............BLOCK_STATUS == ’CHANGED’ ’CHANGED’ THEN THEN COMMIT_FORM..... Explain that the second example is a form-level trigger code for testing the current block name and then navigating depending on the result... IF......... 2000...... .................CURSOR_BLOCK == ’S_ORD’ ’S_ORD’ THEN THEN GO_BLOCK(’S_ITEM’).................... IF IF :SYSTEM. END END IF....................CURSOR_BLOCK :SYSTEM......... All rights reserved......CURSOR_BLOCK :SYSTEM.....Lesson 21: Writing Flexible Code .......CURSOR_BLOCK =’S_INVENTORY’ =’S_INVENTORY’ THEN THEN GO_BLOCK(’S_ORD’).. IF..... 21-8 Oracle Forms Developer: Build Internet Applications I ..................................... GO_BLOCK(’S_INVENTORY’)..... CLEAR_BLOCK.CURSOR_BLOCK :SYSTEM............BLOCK_STATUS :SYSTEM............. ELSIF ELSIF :SYSTEM.................... ELSIF ELSIF :SYSTEM................ END END IF.. GO_BLOCK(’S_ITEM’)...................................CURSOR_BLOCK == ’S_ITEM’ ’S_ITEM’ THEN THEN GO_BLOCK(’S_INVENTORY’)............. COMMIT_FORM... System Status Variables When-Button-Pressed ENTER............. Instructor Note Explain that the first example performs a commit before clearing a block if there are changes to commit within that block. CLEAR_BLOCK.... IF IF :SYSTEM..... ENTER...............

...BLOCK_STATUS CHANGED NEW QUERY SYSTEM.............. Description The form contains at least one record with a status of CHANGED or INSERT....... The user (or a trigger) has not yet entered any values into the base table items of the record....... The block contains only NEW records................................................... The form contains only QUERY records..... The form contains only NEW records......... The block contains only QUERY records.. but no base table item on the record has been updated....Using System Variables for Flexible Coding . Oracle Forms Developer: Build Internet Applications I 21-9 ............. and a base table item on the record has been updated............................................................. System Variables for Determining the Current Status of the Form You can use these system status variables to write code that performs one action for one particular status and a different action for another..................... ..... SYSTEM................... The record was fetched from the database.........................................FORM_STATUS CHANGED NEW QUERY Description The record was fetched from the database...... Description The block contains at least one record with a status of CHANGED or INSERT............... The user (or a trigger) has entered a value into a base table item of a nonfetched record...........RECORD_STATUS CHANGED INSERT NEW QUERY SYSTEM......................

................ 21-10 Oracle Forms Developer: Build Internet Applications I ............................... 2000............................. 2000............................................... All rights reserved............................................................... All rights reserved..... GET_object_PROPERTY Built-Ins • • • • • • • GET_APPLICATION_PROPERTY GET_FORM_PROPERTY GET_BLOCK_PROPERTY GET_RELATION_PROPERTY GET_RECORD_PROPERTY GET_ITEM_PROPERTY GET_ITEM_INSTANCE_PROPERTY Copyright  Oracle Corporation...............Lesson 21: Writing Flexible Code .......... ................................................... GET_object_PROPERTY Built-Ins • • • • • • • GET_LOV_PROPERTY GET_RADIO_BUTTON_PROPERTY GET_MENU_ITEM_PROPERTY GET_CANVAS_PROPERTY GET_TAB_PAGE_PROPERTY GET_VIEW_PROPERTY GET_WINDOW_PROPERTY Copyright  Oracle Corporation........................................

.......item_canvas).............. Oracle Forms Developer: Build Internet Applications I 21-11 ..................Using Built-in Subprograms for Flexible Coding ...................................................GET_BLOCK_PROPERTY(’blockname’................... GET_APPLICATION_PROPERTY The GET_APPLICATION_PROPERTY built-in returns information about the current Form Builder application.. ...................................... Example To determine the canvas that the item with the input focus displays on...... GET_ITEM_PROPERTY The GET_ITEM_PROPERTY built-in returns information about a specified item.... BEGIN cv_name := GET_ITEM_PROPERTY(:SYSTEM.... Example The following example captures the username and operating system information: :GLOBAL...............CURSOR_ITEM.............................................. Example To determine the current record that is visible at the first (top) line of a block: ..... :GLOBAL.............. ......... use: DECLARE cv_name varchar2(30)........top_record).......... GET_BLOCK_PROPERTY The GET_BLOCK_PROPERTY built-in returns information about a specified block............o_sys := GET_APPLICATION_PROPERTY(OPERATING_SYSTEM).................username := GET_APPLICATION_PROPERTY(USERNAME)............... Using Built-in Subprograms for Flexible Coding Some of Form Builder built-in subprograms provide the same type of run-time status information that built-in system variables do..........

........................ Instructor Note Use SET_ITEM_PROPERTY to change fonts and colors directly... 2000............................................................. .................................. SET_object_PROPERTY Built-Ins • • • • • • • SET_LOV_PROPERTY SET_RADIO_BUTTON_PROPERTY SET_MENU_ITEM_PROPERTY SET_CANVAS_PROPERTY SET_TAB_PAGE_PROPERTY SET_VIEW_PROPERTY SET_WINDOW_PROPERTY Copyright  Oracle Corporation.......... 2000.Lesson 21: Writing Flexible Code ...................................................... SET_object_PROPERTY Built-Ins • • • • • • • SET_APPLICATION_PROPERTY SET_FORM_PROPERTY SET_BLOCK_PROPERTY SET_RELATION_PROPERTY SET_RECORD_PROPERTY SET_ITEM_PROPERTY SET_ITEM_INSTANCE_PROPERTY Copyright  Oracle Corporation.... All rights reserved.............. 21-12 Oracle Forms Developer: Build Internet Applications I ..................... Use the SetFontDemo............................................fmb file...................... All rights reserved..................

. CURRENT_RECORD................................ ’VA_CURR’)........PROPERTY_TRUE)............................... if it is already disabled................ VISUAL_ATTRIBUTE........... SET_MENU_ITEM_PROPERTY The SET_MENU_ITEM_PROPERTY built-in modifies the given properties of a menu item....ENABLED.......... SET_ITEM_INSTANCE_PROPERTY The SET_ITEM_INSTANCE_PROPERTY built-in modifies the specified instance of an item in a block by changing the specified item property....Using Built-in Subprograms for Flexible Coding ...... END IF............................. SET_TAB_PAGE_PROPERTY The SET_TAB_PAGE_PROPERTY built-in sets the tab page properties of the specified tab canvas page......................................................... Example To enable the save menu item in a file menu: SET_MENU_ITEM_PROPERTY(’FILE. ... Example To enable tab_page_1... enabled..........SAVE’... END................... use: DECLARE tbpg_id TAB_PAGE. enabled) = ’FALSE’ THEN SET_TAB_PAGE_PROPERTY(tbpg_id.......... Example The following example sets the visual attribute to VA_CURR for the current record of the current item: SET_ITEM_INSTANCE_PROPERTY(:SYSTEM....... Oracle Forms Developer: Build Internet Applications I 21-13 ............... property_true).. BEGIN tbpg_id := FIND_TAB_PAGE(’tab_page_1’).... IF GET_TAB_PAGE_PROPERTY(tbpg_id.................................CURSOR_ITEM...

. 21-14 Oracle Forms Developer: Build Internet Applications I ......................... .......................................SHOW_LOV(’my_lov’) ........... All rights reserved.........................SHOW_LOV(’my_lov’) ID Copyright  Oracle Corporation...........................................................................SHOW_LOV(lov_id) Referencing an object by name: ............................................................ 2000............. Object IDs Finding the object ID: ID lov_id lov_id := := FIND_LOV(’my_lov’) FIND_LOV(’my_lov’) Referencing an object by ID: ..............................Lesson 21: Writing Flexible Code ..................................

.. Oracle Forms Developer: Build Internet Applications I 21-15 ...... The types for object IDs are predefined in Form Builder............. when referring to an item..... The return values of the FIND_ subprograms (the object IDs) are of a specific type.... When you refer to an object by name in a trigger...................... Referencing Objects by Internal ID Form Builder assigns an ID to each object that you create. There is a different type for each object...Referencing Objects by Internal ID ........................) • Writing more generic code • Testing whether an object exists (using the ID_NULL function and FIND_object) ................. use BLOCKNAME...................................................................... An object ID is an internal value that is never displayed................................. The FIND_ subprograms require a fully qualified object name as a parameter.... Three Reasons for Using Object IDs • Improving performance (Form Builder looks up the object only once when you initially call the FIND_ subprogram to get the ID....................................... For instance.......... Form Builder must look up the object ID each time................ You can get the ID of an object by calling the built-in FIND_ subprogram appropriate for the object....ITEMNAME..........................................

........................ All rights reserved..............................Lesson 21: Writing Flexible Code ......................... 21-16 Oracle Forms Developer: Build Internet Applications I .......... 2000.................. 2000............................ FIND_ Built-Ins • • • • • FIND_FORM FIND_BLOCK FIND_ITEM ID FIND_RELATION FIND_LOV Copyright  Oracle Corporation............... FIND_ Built-Ins • • • • • FIND_WINDOW FIND_VIEW FIND_CANVAS ID FIND_ALERT FIND_EDITOR Copyright  Oracle Corporation....................................... ................................................................. All rights reserved.....................................................

..................................................................................... Oracle Forms Developer: Build Internet Applications I 21-17 ..................... along with the object classes that use them and the return types they produce: Object Class Alert Block Canvas Editor Form Item LOV Relation View Window Subprogram FIND_ALERT FIND_BLOCK FIND_CANVAS FIND_EDITOR FIND_FORM FIND_ITEM FIND_LOV FIND_RELATION FIND_VIEW FIND_WINDOW Return Type ALERT BLOCK CANVAS EDITOR FORMMODULE ITEM LOV RELATION VIEWPORT WINDOW ..................... Form Builder Class Types The table below lists some of the FIND_ subprograms......Referencing Objects by Internal ID .........................................................................................................................................................................

’Current’)............ All rights reserved................................. Using Object IDs • • Declare a PL/SQL variable of the same data type......................... Copyright  Oracle Corporation.CURSOR_ITEM).............. 2000......... • Use the variable within the current PL/SQL block only......... END.............................. SET_ITEM_PROPERTY(item_var... 2000...30....................... All rights reserved......................... Using Object IDs Example: DECLARE item_var item....Lesson 21: Writing Flexible Code ................. BEGIN item_var := FIND_ITEM(:SYSTEM................... SET_ITEM_PROPERTY(item_var... Use the variable for any later reference to the object...........position....................55)........ .......................................... Copyright  Oracle Corporation.......prompt_text. 21-18 Oracle Forms Developer: Build Internet Applications I ..

..... You must declare a variable of the same type as the object ID.itemname)... You cannot........... You can use either object IDs or object names in the same argument list................................. you must first assign it to a variable.. use an object ID and an object name to form a fully qualified object_name (blockname...... rather than referring to the object by name.................. DECLARE id_var item......35)..... The following example uses the FIND_ITEM built-in to assign the ID of the item that currently has input focus to the variable id_var...position...................50...... The two examples below show that you can pass either an item name or an item ID to the SET_ITEM_PROPERTY built-in subprogram.position....................... however.’item_name’)......price’................50........................ Declaring Variables for Object IDs To use an object ID...... END.... you can use that variable to reference the object...........CURSOR_ITEM)....... Once you assign an object ID to a variable in a trigger or PL/SQL program unit........Referencing Objects by Internal ID . Oracle Forms Developer: Build Internet Applications I 21-19 .... .............. provided that each individual argument refers to a distinct object........... ..... SET_ITEM_PROPERTY(id_var.. Note: Use the FIND_ built-in subprograms only when referring to an object more than once in the same trigger or PL/SQL program unit........................... BEGIN id_var := FIND_ITEM(:SYSTEM... .35)............ .... The following calls are logically equivalent: SET_ITEM_PROPERTY(’S_ITEM...................... The following call is illegal: GO_ITEM(block_id...

................. .... Using Object IDs • • A PL/SQL variable has limited scope............. All rights reserved................................................................... 21-20 Oracle Forms Developer: Build Internet Applications I ..................................id extension: – Broadens the scope – Converts to a numeric format – Enables assignment to a global variable – Converts back to the object data type Copyright  Oracle Corporation..........Lesson 21: Writing Flexible Code .. An ......................................................... 2000......................................................................................................

. you need to convert it back to its original data type. you need to convert the ID to a numeric format using an ............................CURSOR_ITEM).id extension for your declared PL/SQL variable...id.... you can increase the scope of an object ID............. then assign it to a global variable.id := TO_NUMBER(:GLOBAL................... .................................................... BEGIN item_var....... You can only reference these PL/SQL variables in the current PL/SQL block............... however............. You can pass the global variable around within the application.......... To reference an object ID outside the initial PL/SQL block....item)..................... BEGIN item_var := FIND_ITEM(:SYSTEM. Oracle Forms Developer: Build Internet Applications I 21-21 ....... Using Object IDs Outside the Initial PL/SQL Block You have seen how object IDs are referenced within the trigger or program unit by means of PL/SQL variables...... END........ GO_ITEM(item_var)............ then to a global variable (global............ Example The following example shows the conversion of the global variable back to its original PL/SQL variable data type: DECLARE item_var item.........................item := item_var...... END..item): DECLARE item_var item......... To be able to reuse the object ID............ :GLOBAL............ Example The following example of trigger code assigns the object ID to a local PL/SQL variable (item_var) initially....................Referencing Objects by Internal ID ..

................... All rights reserved.................................................................................................. ..... Referencing Objects Indirectly ITEM A Direct reference KIDSPORT ITEM B Indirect reference ITEM A ITEM A Kidsport Copyright  Oracle Corporation.....................................................................................................................Lesson 21: Writing Flexible Code .................................................... 21-22 Oracle Forms Developer: Build Internet Applications I ... 2000..........

...... You can reference items indirectly with the NAME_IN and COPY built-in subprograms.......... you can write more generic.. because direct references cannot be resolved................ reusable code......................... ........................................................................................................................ Using variables instead of actual item names............ Oracle Forms Developer: Build Internet Applications I 21-23 ........................... Referencing Items Indirectly By referencing items indirectly........................Referencing Items Indirectly ................... you can write a PL/SQL program unit to use any item whose name is assigned to the indicated variable......................... Note: Use indirect referencing when you create procedures and functions in a library module.......................

...........:GLOBAL.......... 2000..................customer_name).................. All rights reserved...................................:GLOBAL.................................................... All rights reserved..... • Indirect copy COPY(’Kidsport’........... COPY(’Kidsport’.................’S_CUSTOMER........................... Copyright  Oracle Corporation...customer_name).Lesson 21: Writing Flexible Code ........................... 2000...... Referencing Objects Indirectly The COPY procedure allows: • Direct copy COPY(’Kidsport’............name’)....... 21-24 Oracle Forms Developer: Build Internet Applications I .... ............. Referencing Objects Indirectly The NAME_IN function: • Returns: – The contents of variable – Character string • Use conversion functions for NUMBER and DATE Copyright  Oracle Corporation.......................................

’S_CUSTOMER................................:GLOBAL....... For instance: date_var := TO_DATE(NAME_IN(’S_ORD....... The first example below shows direct referencing and the second shows indirect referencing: COPY(’Kidsport’................ Using the NAME_IN Built-in Function The NAME_IN function returns the contents of an indicated variable.. In a library.name’) = ’Kidsport’............... The first one uses a direct reference to customer.............customer_name)..................date_ordered’)). Using the COPY Built-in Procedure The COPY built-in assigns an indicated value to an indicated variable or item.... convert the string to the desired data type with the appropriate conversion function.. Unlike the standard PL/SQL assignment statement....... The return value of NAME_IN is always a character string..... The following statements are equivalent....... Oracle Forms Developer: Build Internet Applications I 21-25 ...NAME_IN(’GLOBAL........................ whereas the second uses an indirect reference: IF :S_CUSTOMER.. you could avoid this direct reference by using: IF NAME_IN(’S_CUSTOMER...... using the COPY built-in enables you to indirectly reference the item whose value is being set......... ...........................customer_name’))..........................name = ’Kidsport’. as in the following example: COPY(’Kidsport’..................name.... COPY(’Kidsport’...........................Referencing Items Indirectly ........ To use NAME_IN for a date or number item...name’).............................. Use the COPY built-in subprogram with the NAME_IN built-in to assign a value to an item whose name is stored in a global variable.......

................Lesson 21: Writing Flexible Code ....... Summary • Use system variables: – To avoid hard-coding object names – To return information about the current state of the form • Use GET_object_PROPERTY built-ins to return current property values for Form Builder objects...................... 2000.............................................. All rights reserved... 2000.............. Summary • • Use object IDs to improve performance.......................... Copyright  Oracle Corporation............ 21-26 Oracle Forms Developer: Build Internet Applications I ........... Use indirect referencing to allow form module variables to be referenced in library and menu modules......................... Copyright  Oracle Corporation..... All rights reserved.. .........................................................................................................................

............................................................................................................................................................................. to allow form module variables to be referenced in library and menu modules .................................................................To avoid hard-coding object names ....... Summary Use the following to write flexible code: • System variables: .......Summary .............. to return current property values for Form Builder objects • Object IDs................To return information about the current state of the form • GET_object_PROPERTY built-ins...... to improve performance • Indirect referencing............ Oracle Forms Developer: Build Internet Applications I 21-27 ......

...................... 2000.. Note For solutions to this practice.. see Practice 21 in Appendix A..................................... 21-28 Oracle Forms Developer: Build Internet Applications I ............. “Practice Solutions..................................................Lesson 21: Writing Flexible Code .......... Practice 21 Overview This practices covers the following topics: • Populating product images only when the image item is displayed • Modifying the When-Button-Pressed trigger of the Image_Button in order to use object IDs instead of object names Copyright  Oracle Corporation...................................................” .............................................................. All rights reserved..........................................................

... • Populating product images only when the image item is displayed • Modifying the When-Button-Pressed trigger of the Image_Button in order to use object IDs instead of object names .................. Practice 21 Overview In this practice............ you use properties and variables in the ORDGXX form to provide flexible use of its code... You also make use of object IDs..................................................................................... Oracle Forms Developer: Build Internet Applications I 21-29 .........................................................................................Practice 21 Overview ..............................................................................................

... 21-30 Oracle Forms Developer: Build Internet Applications I ..................... Practice 21 1 In the ORDGXX form....................... Declare variables for these IDs................. alter the triggers that populate the Product_Image item when the image item is displayed...................Lesson 21: Writing Flexible Code ...................................................................................... ........... compile......... 2 Alter the When-Button-Pressed trigger on the Image_Button so that object IDs are used........................... Add a test in the code to check Product_Image.. and use them in each item reference in the trigger............ 3 Save...................... Use the GET_ITEM_PROPERTY built-in function............. Use a FIND_object function to obtain the IDs of each item referenced by the trigger................... Perform the trigger actions only if the image is currently displayed........................ and run the form to test these features.....

...... Sharing Objects and Code .........22 ..................

...................................................................................................................................................Lesson 22: Sharing Objects and Code ....... All rights reserved................................................ 2000................................ Objectives After completing this lesson....... you should be able to do the following: • Describe the various methods for reusing objects and code • • • • Inherit properties from property classes Group related objects for reuse Reuse objects from an object library Reuse PL/SQL code Copyright  Oracle Corporation.. Schedule Topic Lecture Practice Total Timing 50 minutes 30 minutes 80 minutes .......................... 22-2 Oracle Forms Developer: Build Internet Applications I ....................................

........... ................................. You also learn how to share code using the PL/SQL Library..........................................Introduction ................ you learn how to share objects between form modules using the Object Library............................................................................... In this lesson................................................................................ Introduction Overview Form Builder includes some features specifically for object and code reuse.. Oracle Forms Developer: Build Internet Applications I 22-3 ..........................................

................................ Sharing and Reusing Code • • • • Increases productivity Decreases maintenance Increases modularity Maintains standards Copyright  Oracle Corporation........................................................................................ 2000............................................. 22-4 Oracle Forms Developer: Build Internet Applications I ......................................................Lesson 22: Sharing Objects and Code ................................................................. ................ All rights reserved....

............ Decrease Maintenance By creating applications that use or call the same object or piece of code several times............ By sharing and reusing frequently used objects and code..................... Maintain Standards You can maintain standards by reusing objects and code..........Reusable Objects and Code Overview ........................................................................ you can decrease maintenance time.......................... you can cut down development time and increase productivity.................................... Reusable Objects and Code Overview When you are developing applications. Oracle Forms Developer: Build Internet Applications I 22-5 ......................... .......................... you should share and reuse objects and code wherever possible in order to: • Increase productivity • Decrease maintenance • Increase modularity • Maintain standards Increase Productivity You can develop applications much more effectively and efficiently if you are not trying to “start over” each time you write a piece of code........... you can create a set of standard objects and some pieces of standard code and use them as a starting point for all of your new form modules...... If you create an object once and copy it again and again........ Increase Modularity Sharing and reusing code increases the modularity of your applications.............. you do not run the risk of introducing minor changes................ In fact.................

................ 22-6 Oracle Forms Developer: Build Internet Applications I ............................................... Property Classes Canvas Relation properties properties Block Item properties properties LOV properties Copyright  Oracle Corporation...........Lesson 22: Sharing Objects and Code ............................... All rights reserved............................................................. ................................................... 2000.......................................................................................

........................ ............................................................. Property Class What Is a Property Class? A property class is a named object that contains a list of properties and their settings......................... Why Use Property Classes? Use property classes to increase productivity by setting standard or frequently used values for common properties and associating them with several Form Builder objects.... Property classes enable you to define standard properties not just for one particular object...............................................................Property Class ...................... This results in increased productivity.............................................................. but for several at a time.............. because it eliminates the time spent on setting identical properties for several objects. Oracle Forms Developer: Build Internet Applications I 22-7 ...............................

.............................. 2000.... • Include properties for different objects.................. Property Class Icons Add Property Inherit Property Delete Property Property Class Copyright  Oracle Corporation..................Lesson 22: Sharing Objects and Code ..................................... • Create a property class in the Object Navigator....... All rights reserved.............................. • Associate a property class with an object.................. 22-8 Oracle Forms Developer: Build Internet Applications I ................................................................................. ..................... Instructor Note • Create a property class in the Property Palette............................................

............... How to Create a Property Class from the Property Palette 1 In the Object Navigator................ select the properties you want to copy into a property class.............. 3 Add the required properties and their values using the Add Property button in the Property Palette.. Creating a Property Class When you create a property class............................... You choose the properties and their values for the property class............................................... and click the Property Class icon......................... 2 Move to the Property Palette...... Deleting a Property You can remove properties from a property class using the Delete Property button....... 3 Use the Object Navigator to locate the property class and change its name...... You can create a property class in two ways: • Using the Create button in the Object Navigator • Using the Create Property Class button How to Create a Property Class from the Object Navigator 1 Click the Property Class node............................ you have all the properties from every Form Builder object available........................Creating a Property Class . 2 Click Create......................... Set the value for that property using the Property Palette...... click the object whose properties you want to copy into a property class........ Adding a Property Once you create a property class. you can add a property by clicking the Add Property button and selecting a property from the list.. An information alert is displayed................................ A new property class entry displays..... . Oracle Forms Developer: Build Internet Applications I 22-9 .................

.....Lesson 22: Sharing Objects and Code ...................... Convert an inherited property to a variant property................ Inheriting Properties • • • Set the Subclass Information property..................... Convert a variant property to an inherited property........................ All rights reserved........................................... 22-10 Oracle Forms Developer: Build Internet Applications I ..................... Inherited and Variant Properties Property palette Property palette Default property Default property Default property Default property Default Default property property Change Changed property Property palette Inherited property Variant property Inherited property Inherited property Property class Apply Property palette Change Inherit Inherited property Inherited property Inherited property Copyright  Oracle Corporation....................... 2000................. Copyright  Oracle Corporation....................................................... ........................ 2000.................. All rights reserved.....................

.

....................................................... ................................................... All rights reserved.......................................................Lesson 22: Sharing Objects and Code ............. Object Group • • Is a logical container Enables you to: – Group related objects – Copy multiple objects in one operation Copyright  Oracle Corporation....................................................................... 22-12 Oracle Forms Developer: Build Internet Applications I ......................................................... 2000..

.

.................................... and form-level trigger......... • Drag the object group and drop it into a second form module....... All rights reserved........... . • Point out that the objects in the object group are still visible in their respective positions in the Object Navigator...................... Using Object Groups • Blocks include: – Items – Item-level triggers – Block-level triggers – Relations • • Object groups cannot include other object groups Deleting: – An object group does not affect the objects – An object affects the object group Copyright  Oracle Corporation... • Include a block................................. 2000............. canvas-view................................Lesson 22: Sharing Objects and Code ................... 22-14 Oracle Forms Developer: Build Internet Applications I .......................... Instructor Note • Create an object group..................................................................................................

.

.... What Is Subclassing? Company Name: Company Code: Balance: Ability to add to object Ability to make exact copy of object Company Name: Company Name: Company Code: Company Code: Balance: Balance: Address: Code: Copyright  Oracle Corporation... Copying Objects Company Name: Company Code: Balance: Ability to make exact copy of object Company Name: Company Code: Balance: Copyright  Oracle Corporation..................................................................................................... 22-16 Oracle Forms Developer: Build Internet Applications I .................................................... All rights reserved............................ 2000.............. All rights reserved.................................... 2000.......Lesson 22: Sharing Objects and Code ...... ........................................................

.

................... Subclassing Company Name: Company Code: Balance: Ability to add to object Ability to make exact copy of object Ability to alter properties Company Name: Company Name: Company Name: Company Code: Company Code: Company Code: Balance: Balance: Balance: Address: Code: Copyright  Oracle Corporation.........................................Lesson 22: Sharing Objects and Code .............................. it never inherits those overridden properties from the parent............ 2000....................................... 22-18 Oracle Forms Developer: Build Internet Applications I ....... ................... All rights reserved..................... Instructor Note If you create an object without subclassing it.. This conforms to the inheritance model above............................................. but it is not always well understood........... then change the properties from the default values..................... and later decide to subclass the object...........................................

the changes also apply to the properties of the subclassed object that you have not altered... Ability to Alter Properties With subclassing................................................... Arrow The value for the property was inherited..... and this severely limited the usefulness of the reference mechanism............ Subclassing is similar to referencing in Oracle Forms Developer Release 1. For example............................................. Square The value for the property was changed from the default.. if the parent and child objects are in the same form • When you reload the form containing a child object ..... However..... but is more powerful and reflects true object subclassing... This provides a powerful object inheritance model....... you can make an exact copy and then alter the properties of some objects................... Ability to Add to an Object You can still create an exact copy of an object. you can identify inherited or overridden properties...... Ability to Inherit Changes When you change the properties of a parent object...... Subclassing an Object Earlier versions of Form Builder provided only the ability to inherit from a base class............................. as with referencing.. Arrow with a red cross over it The value for the property was inherited but overridden (variant property)......... Oracle Forms Developer: Build Internet Applications I 22-19 .......... With Property Palette...Copying and Subclassing Objects and Code .......... If you change the parent class........................................ but you can add to the subclassed object.. The child inherits changes: • Immediately. all child objects inherit those properties if they are not already overridden..... any properties that you override remain overridden.................. Property Palette Icon Meaning Circle The value for the property is the default.... you can add additional items to a subclassed block......................

................................................ All rights reserved...................................................................................................Lesson 22: Sharing Objects and Code ........................ 2000.. Inheriting Changes Make changes to parent Company Name: Company Code: Balance: Ability to inherit changes Ability to inherit changes Ability to inherit changes Company Name: Company Name: Company Name: Company Code: Company Code: Company Code: Balance: Balance: Balance: Address: Code: Copyright  Oracle Corporation............................. .................................................................. 22-20 Oracle Forms Developer: Build Internet Applications I ....................................

.

Lesson
22: Sharing Objects and Code
......................................................................................................................................................

An Object Library


Is a convenient container of objects for reuse

Simplifies the sharing of reusable components

Simplifies reuse in complex environments
Supports corporate, project, and personal
standards

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
22-22
Oracle Forms Developer: Build Internet Applications I

Lesson
22: Sharing Objects and Code
......................................................................................................................................................

Object Libraries


Appear in the Navigator if they are open
Are used with a simple tabbed interface
Are saved to .olb file or to
database

Copyright  Oracle Corporation, 2000. All rights reserved.

Benefits of the Object Library


Simplifies the sharing and reuse of objects
Provides control and enforcement of standards
Eliminates the need to maintain multiple
referenced forms

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
22-24
Oracle Forms Developer: Build Internet Applications I

Working with Object Libraries
......................................................................................................................................................

Working with Object Libraries
Object libraries appear in the Navigator if they are open. You can create, open, and
close object libraries like other modules. Object libraries are automatically reopened
when you start up Form Builder, making your reusable objects immediately
accessible. It is easy to use object libraries with a simple tabbed interface. This
interface has Add and Remove tab pages that help you to create your own groups.
Double-clicking on the tab and dragging an object to it from the object library creates
a subclassed object. To create a copy of the object, press [Control] and drag the object.
To move the object out of the object library and into a form, press [Shift] and drag the
object. You can save object libraries to a file system as .olb files, or to the database.
How to Populate an Object Library
1 Select Tools—>Object Library to display the object library.
2 Drag objects from the Object Navigator into the object library. The
descriptive comment comes from the object Comment property, but it
can be edited independently of that property.
Benefits of the Object Library
There are several advantages to using object libraries to develop applications:
• Simplifies the sharing and reuse of objects
• Provides control and enforcement of standards
• Eliminates the need to maintain multiple referenced forms

......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
22-25

Lesson
22: Sharing Objects and Code
......................................................................................................................................................

A SmartClass

Is an object in an object
library that is frequently
used as a class

Can be applied easily and
rapidly to existing objects

Can be defined in many
object libraries

Check indicates a SmartClass.
You can have many
SmartClasses of a given object type.

Copyright  Oracle Corporation, 2000. All rights reserved.

Working with SmartClasses

1. Select an object in the
Layout Editor or
Navigator.
2. From the pop-up menu,
select SmartClasses.
3. Select a class from the list.

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
22-26
Oracle Forms Developer: Build Internet Applications I

What Is a SmartClass?
......................................................................................................................................................

What Is a SmartClass?
A SmartClass is a special member of an Object Library. Unlike other Object Library
members, it can be used to subclass existing objects in a form using the SmartClass
option from the right mouse button popup menu. Object Library members which are
not SmartClasses can only be used to create new objects in form modules into which
they are added.
If you frequently use certain objects as standards, such as standard buttons, date items,
and alerts, you can mark them as SmartClasses by selecting each object in the object
library and choosing Object—>SmartClass.
You can mark many different objects that are spread across multiple object libraries as
SmartClasses.
You can also have many SmartClasses of a given object type; for example:
• Wide_Button
• Narrow_Button
• Small_Iconic_Button
• Large_Iconic_Button
How to Work with SmartClasses
1 Select an object in the Layout Editor or Navigator.
2 From the pop-up menu, select SmartClasses. The SmartClasses pop-up
menu lists all the SmartClasses from all open object libraries that have
the same type as the object. When you select a class for the object, it
becomes the parent class of the object. You can see its details in the
Subclass Information dialog box, just like any other subclassed object.
This mechanism makes it very easy to apply classes to existing objects.

......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
22-27

Lesson
22: Sharing Objects and Code
......................................................................................................................................................

Reusing PL/SQL

Triggers:
– Copy and paste text
– Copy and paste within a module
– Copy to or subclass from another module
– Move to an object library

PL/SQL program units:
– Copy and paste text
– Copy and paste within a module
– Copy to or subclass in another module
– Create a library module
– Move to an object library
Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
22-28
Oracle Forms Developer: Build Internet Applications I

Reusing PL/SQL
......................................................................................................................................................

Reusing PL/SQL
PL/SQL in Triggers
You can reuse the PL/SQL in your triggers by:
• Copying and pasting, using the Edit menu
• Copying to another area of the current form module, using Copy and
Paste on the menu of the right mouse button
• Copying to or subclassing from another form module, using drag and
drop in the Object Navigator
• Moving the trigger to an object library
PL/SQL Program Units
Although triggers are the primary way to add programmatic control to a Form Builder
application, using PL/SQL program units supplement triggers, you can reuse code
without having to retype it.
With Form Builder, you can create PL/SQL program units to hold commonly used
code. These PL/SQL program units can use parameters, which decrease the need to
hard-code object names within the procedure body.
You can reuse PL/SQL program units by:
• Copying and pasting, using the Edit menu
• Copying or subclassing to another form module, using drag and drop in
the Object Navigator
• Creating a library module
• Moving the program unit to an object library

......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
22-29

Lesson
22: Sharing Objects and Code
......................................................................................................................................................

PL/SQL Libraries

Applications
Procedures

Functions
Form modules
Menu modules
Report modules
Graphic modules

.pll or
Database

Packages

Library
Copyright  Oracle Corporation, 2000. All rights reserved.

Writing Code for Libraries

A library is a separate module, holding
procedures, functions, and packages.


Direct references to bind variables are not allowed.

Use functions, where appropriate,
to return values.

Use subprogram parameters for passing bind
variables.

Copyright  Oracle Corporation, 2000. All rights reserved.

......................................................................................................................................................
22-30
Oracle Forms Developer: Build Internet Applications I

PL/SQL Libraries
......................................................................................................................................................

PL/SQL Libraries
A library is a collection of PL/SQL program units, including procedures, functions,
and packages. A single library can contain many program units that can be shared
among the Oracle Forms Developer modules and applications that need to use them.
A library:
• Is produced as a separate module and stored in either a file or the
database
• Provides a convenient means of storing client-side code and sharing it
among applications
• Means that a single copy of program units can be used by many form,
menu, report, or graphic modules
• Supports dynamic loading of program units
Scoping of Objects
Because libraries are compiled independently of the Oracle Forms Developer modules
that use them, bind variables in forms, menus, reports, and displays are outside the
scope of the library. This means that you cannot directly refer to variables that are
local to another module, because the compiler does not know about them when you
compile the library program units.
There are two ways to avoid direct references to bind variables:
• You can refer to global variables and system variables in forms
indirectly as quoted strings by using certain built-in subprograms.
• Write program units with IN and IN OUT parameters that are designed
to accept references to bind variables. You can then pass the names of
bind variables as parameters when calling the library program units from
your Oracle Forms Developer applications.
Example
Consider the second method listed above in the following library subprogram:
FUNCTION locate_emp(bind_value IN NUMBER) RETURN VARCHAR2 IS
v_ename VARCHAR2(15);
BEGIN
SELECT ename INTO v_ename FROM emp WHERE empno = bind_value;
RETURN(v_ename);
END;

......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
22-31

..........Lesson 22: Sharing Objects and Code ....................................................................................... 2000.......................................................................................................... 22-32 Oracle Forms Developer: Build Internet Applications I . Attach Library Dialog Box Copyright  Oracle Corporation. 2000.......... .................. All rights reserved......... Creating Library Program Units Copyright  Oracle Corporation............... All rights reserved..................................................

....... if required.............. 4 Click Attach........ report........... ............ or graphics............... 2 Expand the module and select the Attached Libraries node in the Navigator..................... you can either: • Select File—>New—>Library from the menus (An entry for the new library then appears in the Navigator) • Select the Libraries node in the Navigator.......Working with PL/SQL Libraries . and select the Create tool from the tool bar There is a Program Units node within the library’s hierarchy in the Navigator... and the name by which the library is to be saved.. This permanently records the library attachment in the definition of this module. and specifications in the same way as in other modules... Working with PL/SQL Libraries Creating a Library You must first create libraries in the builder before you add program units........... you can create procedures............. 5 Save the module to which you have attached the library..... From this node........ you must attach the library to the modules...... To do this. This may be a form.... How to Save the Library 1 With the context set on the library..... 3 In the Attach Library dialog box..................... To attach a library to a module: 1 Open the module that needs to be attached to the library....... specify the library’s name and select File System or Database...... in the Navigator................. menu....... Detaching a Library To later detach a library. package bodies........ simply delete the library entry from the list of Attached Libraries for that module......... functions. the Attach Library dialog box appears..... or graphics module... 2 Select the destination for the library (file system or database)... When you select Create........... Oracle Forms Developer: Build Internet Applications I 22-33 ....... report...................... either in the designer or at run time............................ How to Attach a Library Before you can refer to a library program unit from a form. select the Save option in Form Builder........ That module will then no longer be able to reference the library program units.......... or another library module.... menu..

.. package...............................................Lesson 22: Sharing Objects and Code ...... ).................... Calls and Searches Calls procedure procedure (( ).. ...................................................function...........................call (( )... Searches •Program Units PROCA PROCB •Attached Libraries •Database Copyright  Oracle Corporation. ...function........................... .................................. 22-34 Oracle Forms Developer: Build Internet Applications I ................................... ).... 2000.........call package.............................. All rights reserved.....................

. and pack5......... References are resolved by searching through libraries in the order in which they occur in the attachment list................ You can generate a ........ --library function pack5.................del_emps............del_emps are defined in an attached library: report_totals(:sub1)..............plx based on the open library mylib......... --library package procedure When Several Libraries Are Attached You can attach several libraries to the same Oracle Forms Developer module..................... whether or not they are part of a library.......... Example The following command creates a run-time library named runlib1..... --library procedure v_sum := how_many_people........ If two program units of the same name and type occur in different libraries in the attachment list......PLX Files The library ........ the one in the “higher” library will be executed................ Referencing Attached Library Program Units You refer to library program units in the same way as those that are defined locally... .... When you are ready to deploy your application..................PLX file from Form Builder or from the command line...... then in the libraries that are attached to the calling module.................Working with PL/SQL Libraries ........... Example Assume that the program units report_totals.. Oracle Forms Developer: Build Internet Applications I 22-35 ......... or stored in the database.....PLX file is a platform-specific executable that contains no source.......... since it is located first.... you will probably want to generate a version of your library that contains only the compiled p-code... how_many_people.... Program units are searched for first in the calling module............................pll: GENERATE LIB mylib FILE runlib1........ Creating .................. Remember that objects declared in a package must be referenced with the package name as a prefix.......... without any source..........

................................................ ................................................ 22-36 Oracle Forms Developer: Build Internet Applications I .......................... Summary • Methods of sharing objects and code: – Using property classes – Using object groups – Copying – Subclassing – Creating a library module – Using object libraries Copyright  Oracle Corporation....................... 2000............. Summary • Reasons to share objects and code: – Increased productivity – Increased modularity – Decreased maintenance – Maintaining standards Copyright  Oracle Corporation..................................................................... All rights reserved........................... 2000........................... All rights reserved...............Lesson 22: Sharing Objects and Code ...........

.......................... Reasons to share objects and code: • Increased productivity • Increased modularity • Decreased maintenance • Maintaining standards Methods of sharing objects and code: • Using property classes: Defines standard properties for several objects at a time • Using object groups: Bundles numerous objects into higher-level building blocks that can be used again in another application • Copying: Exports the definition of an object to another module • Subclassing: Creates an object in one module and then subclasses the current definition of that object in any number of target modules at build time........................................... Oracle Forms Developer: Build Internet Applications I 22-37 ................... Summary Forms provides a variety of methods for reusing objects and code................. extends referencing to include object-oriented capabilities • Creating a library module • Using object libraries: Enables drag and drop reuse.................Summary ....................................................................... and provides SmartClasses for default objects ............... This lesson described how to use these methods.................................................................................................

............................................................................................... Practice 22 Overview This practice covers the following topics: • Creating an object group and using this object group in a new form module • • Using property classes • Setting and using SmartClasses Creating an object library and using this object library in a new form module Copyright  Oracle Corporation................................................Lesson 22: Sharing Objects and Code .... 2000................. 22-38 Oracle Forms Developer: Build Internet Applications I .................” ........................................................ All rights reserved...... Note For solutions to this practice...... see Practice 22 in Appendix A.................. “Practice Solutions........................................

............................ You set SmartClasses in the object library and use these classes in the form module.... Practice 22 Overview In this practice....... • Creating an object group and using this object group in a new form module • Using property classes • Creating an object library and using this object library in a new form module • Setting and using SmartClasses ........................................ Oracle Forms Developer: Build Internet Applications I 22-39 .......................... you use an object group and an object library to copy Form Builder objects from one form to another...................................Practice 22 Overview ...................................................................................................................................... You will also create a property class and use it to set multiple properties for several objects...............................

...... Make the Restock_Date format mask a variant property..Restock_Date to MM/DD/YYYY........... Practice 22 1 In the ORDGXX form.......... .fmb. called Stock_Objects....... and the Question_Alert to the personal tab of the object library.......... 3 Create a new form module and copy the Stock_Objects object group into it... Include the following properties and settings: Property Setting Font Name Arial Format Mask 99. Save the form module as STOCKXX..... create an object group.............................. Create an object library and name it summit. and run the form..999 Font Size 8 Justification Right Delete Allowed No Background Color DarkRed 5 Apply ClassA to CV_INVENTORY...... the Toolbar.................. compile.... Create two tabs in the object library called Personal and Corporate. and run the form again. Change the format mask for S_INVENTORY............. CV_INVENTORY canvas............. 22-40 Oracle Forms Developer: Build Internet Applications I . the Restock_Date item and the 6 7 8 9 Max_In_Stock item... create a property class called ClassA....... Save the object library as summit...... Correct the error........................... consisting of the S_INVENTORY block................olb. compile......... and note the error...................Lesson 22: Sharing Objects and Code .. Save......................... Save.............. Add the CONTROL block.......... 2 Save the form.... run the form................................ compile..... and WIN_INVENTORY window..... 4 In the new form module....

................... Use Toolbar as the form horizontal toolbar canvas for this form..... Oracle Forms Developer: Build Internet Applications I 22-41 .... Mark these items as SmartClasses................... Drag these items into your object library......... Set the width and the format mask to your preferred standard...... Product_Lov_Button.... and run the form to test it........ .. one for wide buttons and one for medium buttons. Save this form as DEPTGXX...Practice 22 ... Create a new form and a new data block in the form.............. 11 Try to delete items on the Null canvas............... Hide_Help_Button.................. Set the Canvas property for the following items to NULL: Image_Button.......... Some items are not applicable to this form................... Apply these SmartClasses in your form................ Show_Help_Button............... by means of width..................... For proper behavior........ CONTROL block........... Create a sample date field....... Drag the Toolbar canvas.............. Practice 22 (continued) 10 Create a new form............... Set the Horizontal Toolbar Canvas property to TOOLBAR for the window.. and Question_Alert from the object library into the new form........... What happens and why? 12 Create two sample buttons. and create a data block based on the S_DEPT table......... Place the Toolbar canvas in the new form.... the S_DEPT block must be before the CONTROL block in the Object Navigator.. Subclass the objects......... Stock_Button............. compile....... Set the Window property to WINDOW1 for the Toolbar canvas........

............................................................................Lesson 22: Sharing Objects and Code ............................................................. ............................................................................................................. 22-42 Oracle Forms Developer: Build Internet Applications I .......................................................

...... Introducing Multiple Form Applications .........................23 ..

........................Lesson 23: Introducing Multiple Form Applications ............................................................. 2000............................. All rights reserved...................... Objectives After completing this lesson....... Schedule Topic Lecture Practice Total Timing 50 minutes 30 minutes 80 minutes ............... 23-2 Oracle Forms Developer: Build Internet Applications I .................................... you should be able to do the following: • • Call one form from another form module Define multiple form functionality Copyright  Oracle Corporation...............................................................................................................

............................................................................................... Introduction Overview Oracle Forms Developer applications rarely consist of a single form document...............................................................................................................................................................Introduction .... .......... This lesson introduces you to the ways in which you can link two or more forms.......... Oracle Forms Developer: Build Internet Applications I 23-3 .........................

............. Multiple Form Applications • Behavior: – Flexible navigation between windows – Single or multiple database connections – Transactions may span forms........................................ All rights reserved.. 2000...... starting with current form • Links: – Data is exchanged by global variables or parameter lists – Code is shared as required......... Multiple Form Session Forms Runtime Form C Open Open Form A Form B Open Form D Global variables Copyright  Oracle Corporation. if required – Commits in order of opening forms............................................................... 23-4 Oracle Forms Developer: Build Internet Applications I ...................................... All rights reserved.Lesson 23: Introducing Multiple Form Applications ............................. ................................... 2000............................... through libraries and the database Copyright  Oracle Corporation..........................................

.. as required......... or ended before control is passed to another form.............. This chain of control is used when you exit a form or commit transactions.................... A modular structure indicates the following: • Component forms are only loaded in memory if they are needed............. How Does the Application Behave? The first form module to run is specified before the Form Builder session begins... Multiple Form Applications At the beginning of the course............... so the user can work with several forms concurrently in a session (when forms are invoked by the OPEN_FORM builtin)... Data can be exchanged between forms as follows: • Through global variables....... or each form provides its own separate menus when it becomes the active form....... The commit sequence starts from the current form and follows the opening order of forms......Multiple Form Applications ......... • Form Builder provides the same menus across the application.................... and Form Builder remembers the form that invoked each additional form.. • Database transactions are continued across forms....... we discussed the ability to design Form Builder applications where blocks are distributed over more than one form....... You can design forms to appear in separate windows.... or open their own separate sessions............... which span sessions • Through parameter lists.. • One form can be called from another..... for passing values between specific forms Code can be shared through the following: • Library modules....... providing flexible combinations......... You can design forms for a Forms Runtime session according to the following conditions: • Forms share the same database session......... by attaching them to each form as required • Stored program units in the database ............. producing a modular structure...... using Forms Runtime............................................................ What Links the Forms Together? Each form runs within the same Forms Runtime session............. Oracle Forms Developer: Build Internet Applications I 23-5 ............ Other form modules can be opened in the session by calling built-ins from triggers....... much as they can in a single form.. Users can then navigate between visible blocks of different forms....................

......................... This course concentrates mainly on OPEN_FORM........................ 2000............. now considered the primary method for providing multiple form applications............................................................................................................................ Use of the other two built-ins is discussed further in the course Oracle Forms Developer: Build Internet Applications II......................................................... All rights reserved.......... 23-6 Oracle Forms Developer: Build Internet Applications I ............. ....................Lesson 23: Introducing Multiple Form Applications .... OPEN_FORM MDI MDI FORM A FORM A OPEN_FORM FORM B Modeless Copyright  Oracle Corporation..... Instructor Note The broken line indicates that control need not pass immediately to the opened form (depending on the Activate_Mode argument).............

... data_mode......... This can be done by one of two methods: • Calling a built-in procedure from a trigger in the form • Calling a built-in procedure from a menu item in an attached menu In either case....................... How to Start Another Form Module When the first form in a Forms Runtime session has started........ Oracle Forms Developer: Build Internet Applications I 23-7 .......... OPEN_FORM This is a restricted procedure............ paramlist)... session_mode................. Parameter Description Form_Name Filename of the executable module (without the ........... This built-in also gives you the option to begin a separate database session for the new form....... the available built-ins are those described below................ You can start another form using OPEN_FORM without passing control to it immediately........... and NEW_FORM...........How to Start Another Form Module ....................................... Built-in Procedures for Starting Another Form There are three procedures that you can use to start another form module from one that is already active: OPEN_FORM.. and cannot be called in Enter Query mode................. OPEN_FORM(’form_name’.... it can provide the user with facilities for starting additional forms.......................... or NO_ACTIVATE Session_Mode Either NO_SESSION (the default) or SESSION Data_Mode Either NO_SHARE_LIBRARY_DATA (the default) or SHARE_LIBRARY_DATA (Use this parameter to enable Form Builder to share data among forms that have identical libraries attached...FMX suffix) Activate_Mode Either ACTIVATE (the default).. OPEN_FORM enables you to start another form in a modeless window....... This built-in is normally the preferred way of providing multiple form applications............................. if required....) Paramlist Either the name (in quotes) or internal ID of a parameter list .... so the user can work in other running forms at the same time............... activate_mode..... CALL_FORM..........................

.... 3. 2000... 2000...................................... Define windows and positions for each form.... 2.... You can make changes in the same transaction across forms.........................Lesson 23: Introducing Multiple Form Applications ............................... Plan global variables and their names... OPEN_FORM and the Summit Application • Actions: 1........ 23-8 Oracle Forms Developer: Build Internet Applications I ............. All forms are visible together... All rights reserved............................................... Implement triggers to: – Open other forms – Initialize globals from calling forms – Use globals in opened forms Copyright  Oracle Corporation..... navigating freely between them...................... ........... OPEN_FORM and the Summit Application • Scenario: Run the CUSTOMERS and ORDERS forms in the same session. All rights reserved..................... Copyright  Oracle Corporation........................................................................

........................ or from a Key....................................... and deleted...... if the reference value changes in the calling form. You need one for each item of data that is to be accessible across all the forms in the application.... Consider these requirements for the Summit application: • The CUSTOMERS form must provide an option to start the ORDERS form in the same transaction....... Defining Multiple Form Functionality Using OPEN_FORM to Provide Forms in Multiple Windows You can use OPEN_FORM to link form modules in an application and enable the user to work in them concurrently..................................) ................................... such as When-Button-Pressed.... • The user can see all open forms at the same time... perform the following steps: 1 Create each of the form modules.Initialize global variables in calling forms (This is so that values such as unique keys are accessible to other forms when they open...Defining Multiple Form Functionality ..Make use of received global variables in opened forms (For example............. Note that each form must reference a global variable by the same name...... or from When-New-Object-Instance triggers... updated. 3 Plan and implement triggers to: ................... and freely navigate between them to apply changes.....Open another form (You can do this from item interaction triggers... a Pre-Query trigger can use the global variable’s contents of the global variable as query criteria........... This might need to be done in more than one trigger.................... To provide this kind of functionality....trigger that fires on a keystroke or equivalent menu selection................... and orders for the current customer can be viewed....... inserted. • Changes in all forms can be saved together........ Plan where the windows of each module will appear in relation to those of other modules....... Oracle Forms Developer: Build Internet Applications I 23-9 .............. 2 Plan names for global variables..................) .) ......

...... which the opened form could reset on exit..... For example. 23-10 Oracle Forms Developer: Build Internet Applications I ........................ unless the application does appropriate tests before calling this builtin............................... Linking by Global Variables CUSTOMERS Customer ID ORDERS Order Customer_ID GLOBAL.................. 2000.............................. All rights reserved......... Defining Multiple Form Functionality Note: It is possible to start up several instances of the same form.................Lesson 23: Introducing Multiple Form Applications .....CUSTOMERID Copyright  Oracle Corporation........................................................................................................................................... ....... test a flag (global variable) set by an opened form at startup... or use the FIND_FORM built-in.......... using OPEN_FORM.......

id.........................................................Orders_Button opens the ORDERS form............... and passes control immediately to it.............. OPEN_FORM(’ORDERS’).................. Opening the ORDERS Form from the CUSTOMERS Form This When-Button-Pressed trigger on :CONTROL...... • Reading from a nonexistent global variable causes an error. which has no effect if the variable already exists.......... Oracle Forms Developer: Build Internet Applications I 23-11 ........CUSTOMERID ensures that orders queried at the startup of the ORDERS form apply to the current customer............................ :GLOBAL..................Defining Multiple Form Functionality ................. with a maximum of 255 characters..... The scenario in the slide on the opposite page shows one global variable: GLOBAL.................. ORDERS will use the same database session and transaction..... or by the DEFAULT_VALUE built-in..customerid := :S_CUSTOMER... Planning Global Variables and Their Names You need a global variable for each item of data that is used across the application. • Each global variable is known by the same name to each form in the session........... Reminders: • Global variables contain character data values................................................................... • Global variables can be created by a PL/SQL assignment.. .............

.. 23-12 Oracle Forms Developer: Build Internet Applications I ........... OPEN_FORM(’ORDERS’)... :GLOBAL..customerid....... Execute_Query....................customerid :GLOBAL..... Opening Another Form Example: :GLOBAL......................... Copyright  Oracle Corporation......customerid := := :S_CUSTOMER........................ All rights reserved......................................id... 2000... OPEN_FORM(’ORDERS’)...... 2000....... :S_CUSTOMER......id.......... Copyright  Oracle Corporation....................... Restricted Query at Startup When-New-Form-Instance Execute_Query................ • The transaction continues unless it was explicitly committed before....... ................... you retain control in the current form.. Notes • Control passes immediately to the ORDERS form—no statements after OPEN_FORM are processed............ • If the Activate_Mode argument is set to NO_ACTIVATE.. All rights reserved...........customerid...............customer_id := := :GLOBAL.Lesson 23: Introducing Multiple Form Applications .................... Pre-Query :S_ORD...................customer_id :S_ORD..

with data in context to the calling form............... Users can then navigate to the other form when they choose... Oracle Forms Developer: Build Internet Applications I 23-13 ............................ although the specified form starts up and the rest of the trigger is processed.............. Opening Another Form • When you default the Activate_Mode argument in OPEN_FORM...... • If you want to end the current transaction before opening the next form... This trigger is in the ORDERS form: EXECUTE_QUERY............................................ you produce two triggers: • When-New-Form-Instance: This form-level trigger fires when the form is opened (regardless of whether control is passed to this form immediately or not)......... call the COMMIT_FORM built-in before OPEN_FORM. • Pre-Query: This is usually on the master block of the opened form. control remains in the calling form........ then open the next form in the same transaction......... Because this trigger fires in Enter Query mode.. which are then used as query criteria............. control is passed immediately to the specified form...customerid......... This................................... ........... fires a Pre-Query trigger if one is defined.... This trigger is on the S_ORD block of the ORDERS form: :S_ORD...............................customer_id := :GLOBAL. in turn...............Defining Multiple Form Functionality . This restriction applies for every other query performed on the block thereafter................. • If you set Activate_Mode to NO_ACTIVATE. you can just post changes to the database with POST.......... A query can be initiated by the EXECUTE_QUERY built-in procedure........ and any remaining statements after OPEN_FORM are not executed.. it can populate items with values from global variables............... (Alternatively........) Performing a Restricted Query on Startup To display a query automatically in the opened form..

. 2000........... ... Conditional Opening Example: :GLOBAL........ DEFAULT_VALUE(’’..... 2000....................................................... Pre-Form example: DEFAULT_VALUE(’’..................customerid’)...................customerid := :S_CUSTOMER...... All rights reserved............................... • You can use globals to communicate that the form is running..................... ’GLOBAL.... Assigning Global Variables in the Opened Form • DEFAULT_VALUE ensures the existence of globals..id............. END IF..Lesson 23: Introducing Multiple Form Applications ..................... IF ID_NULL(FIND_FORM(’ORDERS’)) THEN OPEN_FORM(’ORDERS’)................................. 23-14 Oracle Forms Developer: Build Internet Applications I ...... Copyright  Oracle Corporation............ ’GLOBAL...... All rights reserved.. Copyright  Oracle Corporation.......customerid’)........ ELSE GO_FORM(’ORDERS’)...........................

............productid does not exist...........Defining Multiple Form Functionality ...CUSTOMERID if it does not exist when the form starts................ ’GLOBAL...... and ensure that global variables exist by using the DEFAULT_VALUE built-in when the form is opening.................... ......... You can provide independence........ Example This Pre-Form trigger in the ORDERS form assigns a NULL value to GLOBAL..... Conditional Opening Here is a variation of the When-Button-Pressed trigger on Orders_Button in the CUSTOMERS form.. it simply passes control to it... Because the Pre-Form trigger fires before record creation.. Assigning Global Variables in the Opened Form If. :GLOBAL........customerid := :S_CUSTOMER............. using GO_FORM... END IF.... ELSE GO_FORM(’ORDERS’)..... a global variable has not been initialized before it is referenced in a called form......... it ensures existence of global variables at the earliest point.....id................... Oracle Forms Developer: Build Internet Applications I 23-15 ....................... IF ID_NULL(FIND_FORM(’ORDERS’)) THEN OPEN_FORM(’ORDERS’)...... and before all of the When-New-Object-Instance triggers.. DEFAULT_VALUE(’’...................... an error is reported: FRM-40815: Variable GLOBAL...........................customerid’)............................ If the ORDERS form is already running....... for some reason....................................... The ORDERS form can now potentially be called without the CUSTOMERS form.........

..... IF IF :SYSTEM........... ENTER..... • The Commit_Mode argument defines action on uncommitted changes............. ).. Copyright  Oracle Corporation..... 23-16 Oracle Forms Developer: Build Internet Applications I .. Closing a Form with EXIT_FORM • The default functionality is the same as for the Exit key.......................... )............................................................................. 2000...... All rights reserved................... ENTER................... All rights reserved.............................. 2000......... END IF....... Closing the Session Form C Form B Runtime Form A “Will the last one out please turn off the lights” Copyright  Oracle Corporation... ................................. ELSE ELSE EXIT_FORM( EXIT_FORM( NO_COMMIT NO_COMMIT )..FORM_STATUS :SYSTEM............ END IF..................FORM_STATUS == ’CHANGED’ ’CHANGED’ THEN THEN EXIT_FORM( EXIT_FORM( DO_COMMIT DO_COMMIT ).....Lesson 23: Introducing Multiple Form Applications ..........

.... EXIT_FORM(commit_mode) Parameter Description Commit_Mode Defines what to do with uncommitted changes in the current form: • ASK_COMMIT gives the decision to the user (the default)............. you might use this built-in from a Key-Exit or When-Button-Pressed trigger. If the closing form is the only form still running in the Forms Runtime session............................. make the decision to commit (save) or roll back through the EXIT_FORM built-in............ Form Builder checks to see whether there are any uncommitted changes............... the default functionality is the same as described above.... Closing a Form with EXIT_FORM When a form is closed..... Typically........................................ • DO_COMMIT posts and commits changes across all forms for the current transaction........................ so the user is not asked... the user is prompted with the standard alert: Do you want to save the changes you have made? If you are closing a form with EXIT_FORM.................. • The EXIT_FORM built-in is executed from a trigger......Defining Multiple Form Functionality ..... When a multiple form session involves the OPEN_FORM built-in............................. but without validation................................ Oracle Forms Developer: Build Internet Applications I 23-17 ..................... If there are......................... You can... Closing Forms and Forms Runtime Sessions A form may close down and pass control back to its calling form under the following conditions: • The user presses Exit or selects Exit from the Action menu....... • NO_COMMIT validates and rolls back uncommitted changes in the current form.. .. however......... the session will end as a result...... it is possible that the last form to close is not the one that began the session.... • NO_VALIDATE is the same as NO_COMMIT....

...................................................................... You can use this variable to decide whether to attempt a commit in a trigger.Lesson 23: Introducing Multiple Form Applications ......................... ................................................ Other Useful Triggers Maintain referential links between forms through global variables: • In the parent form: – When-Validate-Item – When-New-Record-Instance • In opened forms: When-Create-Record Copyright  Oracle Corporation. 23-18 Oracle Forms Developer: Build Internet Applications I .................................. 2000.......................... Note The system variable SYSTEM........... All rights reserved..........................................................FORM_STATUS contains the value CHANGED if there are uncommitted changes in the current form.................................

............... the record status remains NEW................Defining Multiple Form Functionality ..... ........ potentially changing and inserting records........CUSTOMERID as their default................ Other Useful Triggers When Using OPEN_FORM Because OPEN_FORM enables the user to navigate among open forms.........customerid := :S_CUSTOMER.................... :S_ORD...................... :GLOBAL................ these triggers can help keep referential key values in step across forms..customer_id := :GLOBAL.............. When items are assigned from this trigger...............Id..............customerid..... in case the user navigates to a line item record for a different customer........................... Example In the opened form (ORDERS)........ this assignment to GLOBAL... Oracle Forms Developer: Build Internet Applications I 23-19 ....................CUSTOMERID can be performed in a When-Validate-Item trigger on :S_CUSTOMER.. Example In the parent form (CUSTOMERS)...... The statement can also be issued from a When-New-Record-Instance trigger on the S_CUSTOMER block................ a When-Create-Record trigger on the S_ORD block ensures that new records use the value of GLOBAL..............id.. so that the user can leave the record without completing it.......................... so that the global variable is kept up-to-date with an applied change by the user..............

...............................Lesson 23: Introducing Multiple Form Applications .......................................................................................................... • Forms communicate through global variables: – Load key values in the parent form – Use global values in opened forms for When-New-Form-Instance and Pre-Query Copyright  Oracle Corporation............................ 23-20 Oracle Forms Developer: Build Internet Applications I .. All rights reserved.. ...................... 2000................................................................................................. Summary • The OPEN_FORM built-in provides multiple concurrent forms in a session.................

............................................. • Close a form by using the EXIT_FORM buildt-in..........................Form parameters .....................................Navigating between forms • Passing data between forms: .................. ....... Summary This lesson is an introduction lesson to multiple form applications........... CALL_FORM....... and how to pass information among forms......... you should have learned how to open more than one form module in a Forms Runtime session...........Load key values in the parent form.Summary ...... In this lesson.................... In the course Oracle Forms Developer: Build Internet Applications II............. NEW_FORM built-ins ....................Use global values in opened forms....Parameter lists • Multiple form transactions .....................Closing forms ... there is another lesson that covers this subject in detail....... • The OPEN_FORM built-in provides multiple concurrent forms in a session........OPEN_FORM...... Oracle Forms Developer: Build Internet Applications I 23-21 ................... • Forms communicate through global variables: . particularly for When-New-Form-Instance and Pre-Query.................... The course Oracle Forms Developer: Build Internet Applications II covers the following topics in the lesson “Building Multiple Form Applications”: • Relevant details of calling and opening forms: .

................... Practice 23 Overview This practice covers the following topics: • Linking ORDERS and CUSTOMERS forms by using a global variable • Using built-ins to check whether the ORDERS form is running • Using global variables to restrict a query in the ORDERS form Copyright  Oracle Corporation.... Note For solutions to this practice...............Lesson 23: Introducing Multiple Form Applications ..... All rights reserved........................................ 23-22 Oracle Forms Developer: Build Internet Applications I ....” ...................................................................................................................................... 2000... see Practice 23 in Appendix A.............................. “Practice Solutions.....................................................

............................ you produce a multiple form application by linking the CUSTGXX and the ORDGXX form modules............................................... Oracle Forms Developer: Build Internet Applications I 23-23 ............. Practice 23 Overview In this practice................................................................................................................................................Practice 23 Overview ....................... • Linking ORDERS and CUSTOMERS forms by using a global variable • Using built-ins to check whether the ORDERS form is running • Using global variables to restrict a query in the ORDERS form ................................................

........... Use OPEN_FORM...................... passing control to it..... if required... 23-24 Oracle Forms Developer: Build Internet Applications I .. and run the form to test that it works as a stand-alone...... Define a trigger for CONTROL. Deploy the application to the Web...Customer_Id with the current customer’s ID. Practice 23 1 In the ORDGXX form. then opens the ORDGXX form..... then open the ORDGXX form from the new button..... create a CONTROL block button called Orders_Button.......Customer_Id as the default value for S_ORD.......................... Remember that you need to use the module name in the GO_FORM built-in.. In the CUSTGXX form...Customer_Id... Run the CUSTGXX form... compile..... Alter the Orders_Button trigger in CUSTGXX so that it uses GO_FORM to pass control to ORDGXX if the form is already running.....Lesson 23: Introducing Multiple Form Applications ...... ............ Are the relative positions of the two forms adequate? Change the window location of the ORDGXX form.................. and the filename in the OPEN_FORM built-in........ create a Pre-Form trigger to ensure that a global 2 3 4 5 6 7 8 9 10 variable called Customer_Id exists.............................. Use the FIND_FORM built-in for this purpose........... and set the variable to NULL if it does not yet exist......................................... Use the DEFAULT_VALUE built-in.. Make sure that the internal name of the ORDGXX form (in the Object Navigator) matches the filename of the form. Add code to the CUSTGXX form so that GLOBAL......... Add a trigger to ensure that queries on the S_ORD block are restricted by the value of GLOBAL..Orders_Button that initializes GLOBAL........ Write a When-Create-Record trigger on the S_ORD block that uses the value of GLOBAL.... Write a Pre-Query trigger on the S_ORD block that assigns the value of the global variable to the Customer_Id item........Customer_Id...... Customer_Id is updated when the current Customer_Id changes............. Save................................ Save and compile each form.....

.. Practice Solutions .............A ..................

.............. Close the ORDERS form.. If you cannot expand the node.... Click the Access tab in the Preferences dialog box......Appendix A: Practice Solutions .............. No formal solution.... A-2 Oracle Forms Developer: Build Internet Applications I ......... No formal solution................. No formal solution........ No formal solution... Notice that the module access dialog box is displayed.............. Open the Summit. Click the File option..................... Click OK........fmb form module...........fmb form module from the Open Dialog window............. Click OK........ No formal solution... Select Tools—>Preferences from the default menu system................ No formal solution.. Click the Access tab in the Preferences dialog box.......fmb form module........................... and select “Open an existing form” from the 2 3 4 5 6 7 8 9 Welcome page.... What do you see below this node? No formal solution. Try to open the Customers...... connect to the database and try again.............. Expand the Data Blocks node............. Expand the Database Objects node............. .... Collapse the Data Blocks node....... Form Builder gives you the option of saving the file to the file system or the database.................. Click the Ask option.. Modify your preferences so that Form Builder will access the file system only.. Open the Orders................. Change your preferences so that when you open or save a file...... Click Cancel....... Select Tools—>Preferences from the default menu system.. Practice 1 Solutions 1 Invoke Form Builder.......

................. a .................. Select the Rectangle tool from the Tool Palette and draw a rectangle around the three summit shapes......... and exit Form Builder.................fmb form module to match the screenshot shown below............ At the end................. and select Arrange—>Send to Back.. Move them to the top-right corner of the layout....................... c Select the summit shape in the middle and place it behind the other two shapes. Select Tools—>Layout Editor from the default menu system................................................................ Align the objects along the bottom edge....... d Draw a box with no fill around the summit shapes.......... click the Fill Color tool and select No Fill................. b Move the three summit shapes to the top-right corner of the layout............. save your changes.................................. With the rectangle still selected.. Select the middle summit shape....... Invoke the Layout Editor.............. Shift-click each of the three shapes to select them together.....Practice 1 Solutions .......... Oracle Forms Developer: Build Internet Applications I A-3 ................... 10 Change the layout of the Summit.

......... f Move the Name........................................... Select the text tool from the Tool Palette and enter the text above the rectangle. e ... Select the scroll bar and resize it with the mouse................ A-4 Oracle Forms Developer: Build Internet Applications I ........................ and Region_Id items to match the screenshot....... Add the text Summit Sporting on top of the box.......... Choose a suitable font size and style.....Appendix A: Practice Solutions ............................ Select the First_Name and Last_Name items together........ Id..... h Resize the scroll bar to make it the same height as the three records in the Emp block...... and click the Align Top button....... select File—>Save and then File—>Exit..... Click the Align Left button to align these two items....... Shift-click the Id and Region_Id items to select them together........................... Select and move the Id item up................. In the Object Navigator.................... Select and move the Name item to the right with the mouse...... i Save the form module.................................. and exit Form Builder...................... g Move the First_Name item up to align it at the same level as the Last_Name item..........

.......... Move to the Name item and enter the search value Womansport................. ... Put the form module in Enter Query mode (press [F11] or select Query—>Enter from menu)................................................. 3 Execute an unrestricted query.................... 4 Execute a restricted query to retrieve information about the customer with the ID of 212........ set the Runform parameter Look and Feel to Oracle.... Press [Up] and [Down] to browse through the records returned.. 6 Start another run-time session on the Web using the form module Customers. For this session..... Execute the query (press [Ctrl] + [F11] or select Query—>Execute from menu).. No formal solution... 2 Select Help—>Keys from the menu... No formal solution........ No formal solution... Notice that the status line displays the words ENTER-QUERY..... or press [Execute Query]....... Oracle Forms Developer: Build Internet Applications I A-5 .... Notice that the status line displays the words ENTER-QUERY. Notice the different appearance of the user interface. Notice that only one record is retrieved.. Notice that only one record is retrieved........ Select Query—>Execute................................... 5 Exit this run-time session. Execute the query (press [Ctrl] + [F11] or select Query—>Execute from menu)............Practice 2 Solutions ..................... 7 Execute a restricted query to retrieve the “Womansport” record............ Put the form module in Enter Query mode (press [F11] or select Query—>Enter from menu)........ Practice 2 Solutions Running a Forms Application on the Web 1 Run the form module Customers on the Web... Enter the Runform parameters and run the Customers form....... Move to the Id item and enter the search value 212............................................... or click the Execute Query toolbar button.... Double-click the shortcut on your desktop for Run a Form on the Web..... No formal solution..........

. Click the Billing tab to move to the Sales_Rep_ID item and enter the search criteria >13................. Select Query—>Enter...... Exit the run-time session............... No formal solution...... . Enter USA in the County item..................... Put the form module in Enter Query mode........ Type San% in the City item.......................... Select Query—>Enter............................ Try each of these restricted queries: .. Select the Credit radio button....... Display the customer details for Big John’s Sports Emporium and click the Orders button to move to the Orders form module......... Execute a query to get stock information...........Retrieve all cities starting with San.................. Execute the query........ Query only those orders with a payment type of Credit. 8 Execute a restricted query to retrieve customers with a sales rep ID 9 10 11 12 13 14 greater than 13......Appendix A: Practice Solutions .. . The Inventory block is displayed in a separate window........... No formal solution.. Select Query—>Execute.... Running a Forms Session in Client-Server 1 Start a Forms run-time session by using the form module Customers... Press [Next Record] until you see Big John’s Sports Emporium.... Enter Excellent in the Credit Rating item. Select Query—>Execute........... Select Query—>Enter........ Move to the first record in the Item block and click the Stock button................................. A-6 Oracle Forms Developer: Build Internet Applications I ... Select Query—>Execute.......... Click the Image On button and notice that the image item is displayed........ No formal solution... Click the Image Off button and notice that the image item is no longer displayed.... Click the Orders button................Retrieve all customers based in the USA with a credit rating of Excellent..................

.... Move to the ITEM block and enter the following: Item Product ID Quantity Value 50530 2 5 Save the new records.... Click the Save button................ Move to the ORDER block and select Record—>Insert............ or press the Insert button on the toolbar..... Move to the ORDER block and select Record—>Remove.............. Oracle Forms Developer: Build Internet Applications I A-7 .............. No formal solution.... Notice that the function keys are defined differently in a client-server environment than they are for Web deployment.... Click the Save button... No formal solution.... as detailed below... Now attempt to delete your order and save the change................ Notice that some items are already populated with default values...Practice 2 Solutions ............................................. 2 Select Help—>Keys from the menu. Update the order that you have just placed and save the change.................................. Move to the Item block and select Record—>Remove............ ........ Enter the following: Item Date Shipped Payment Type Order Filled Value Today’s date (DD-MON-YYYY) Cash (radio group button) No (unchecked) 4 Insert a new record in the ITEM block.... What happens? Move to the ORDER block and select Record—>Remove......... 6 7 8 9 10 Select Action—>Save or click the Save button......................... Exit the run-time session..... insert a new record in the ORDER block.... Delete the line item for your order and save the change........ 3 For the customer Big John’s Sports Emporium.............................................. Change the Date Shipped to next Monday and save the change........ Attempt to delete the order that you have just placed..........

Appendix
A: Practice Solutions
......................................................................................................................................................

Practice 4-1 Solutions
1 Create a new form module.

Create a new single block by using the Data Block Wizard.
Base it on the S_CUSTOMER table and include all columns.
Display the S_CUSTOMER block on a new content canvas called
CV_CUSTOMER and show just one record at a time. Set the frame title
to Customers.
If you are not already in Form Builder, run Form Builder and create
a new form module by using the Welcome Wizard. If you are
already in Form Builder, then create a new form module by selecting
File—>New—>Form or by clicking the Create Toolbar button.
Use Tools—>Data Block Wizard to create a block.
Select the block type as Table or View.
Set the Table or View field to S_CUSTOMER.
Click the Refresh button and click the >> button to include all
columns.
Click the Next button, and select “Create the data block, then call
the Layout Wizard” option, and click the Finish button.
In the Layout Wizard, select a new canvas and make sure the Type
field is set to “Content.”
Include all items.
Set the Style to Form.
Set the Frame Title to Customers, and click Finish.
In Object Navigator, rename the canvas as CV_CUSTOMER:
- Select the canvas.
- Click the name.
- The cursor changes to an I-beam; edit the name.
- Press [Return].
2 Save the new module to a file called CUSTGXX, where XX is the group
number that your instructor has assigned to you.
Run your form module and execute a query.
Navigate through the fields. Exit the run-time session and return to Form
Builder.
No formal solution.
3 Change the form module name in the Object Navigator to
CUSTOMERS.
Select the form module. Click the name. The cursor changes to an
I-beam. Edit the name, and then press [Return].

......................................................................................................................................................
A-8
Oracle Forms Developer: Build Internet Applications I

Practice 4-1 Solutions
......................................................................................................................................................

4 In the Layout Editor, reposition the items so that the canvas resembles

the following screenshot.
Hint: First resize the canvas and the frame.
Reposition the items by dragging and dropping them.

5 Save and compile the form module.

Deploy your form module on the Web and execute a query.
No formal solution.

......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
A-9

Appendix
A: Practice Solutions
......................................................................................................................................................

Practice 4-2 Solutions
1 Create a new form module.

Create a new block by using the Data Block Wizard.
Base it on the S_ORD table and include all columns except TOTAL.
Display the S_ORD block on a new content canvas called CV_ORDER
and show just one record at a time. Use a form style layout. Set the frame
title to Orders.
Create a new form module by selecting File—>New—>Form or by
clicking the Create Toolbar button.
Use Tools—>Data Block Wizard to create a block.
Select the block type as Table or View.
Set the Table or View field to S_ORD.
Click the Refresh button and include all columns except Total.
Click the Next button, select “Create the data block, then call the
Layout Wizard” option, and click Finish.
In the Layout Wizard, select a new canvas and make sure the Type
field is set to “Content.”
Include all items.
Set Style to Form.
Set Frame Title to Orders, and click Finish.
In the Object Navigator, rename the canvas as CV_ORDER.
2 Create a new block by using the Data Block Wizard.
Base the block on the S_ITEM table and include all columns.
Create a relationship and select the master block as S_ORD.
Display all items except ORD_ID on the CV_ORDER canvas.
Display six records in this detail block on the same canvas as the master
block.
Use a tabular style layout and include a scroll bar.
Change the order of the blocks in the Object Navigator, moving the
S_ITEM block after the S_ORD block. Set the frame title to Items.
In the same module, create a new block by using Tools—>Data
Block Wizard.
Select block type as Table or View.
Set the Base Table to S_ITEM.
Include all columns.
Click the Create Relationship button.
Select S_ORD block as the master block.
Use the Layout Wizard to create a layout.
Select Canvas as CV_ORDER.

......................................................................................................................................................
A-10
Oracle Forms Developer: Build Internet Applications I

Practice 4-2 Solutions
......................................................................................................................................................

Include all items except ORD_ID.
Do not change any prompts.
Set the Style to Tabular.
Set the Frame Title to Items.
Set the Records Displayed to 6.
Select the Display Scrollbar check box.
In the Object Navigator, drag and drop the S_ITEM block to a
position below the S_ORD block. This step may only be necessary if
you created the block manually.
3 Save the new module to a file called ORDGXX, where XX is the group
number that your instructor has assigned to you.
No formal solution.
4 Create a new block based on S_INVENTORY (do not create any
relationships with other blocks at this time) to display on a different
canvas.
Base it on the S_INVENTORY table, and exclude the
OUT_OF_STOCK_EXPLANATION column from the definition.
Display four records in this block and ensure that they are displayed on a
new content canvas called CV_INVENTORY.
Use a tabular style layout, and include a scroll bar.
In the Object Navigator, move the S_INVENTORY block after the
S_ITEM block. Set the frame title to Stock.
Do not create any relationships between blocks at this stage.
In the same module, create a new block by using Tools—>Data
Block Wizard.
Select block type as Table or View.
Set the Base Table to S_INVENTORY.
Include all columns except the OUT_OF_STOCK_EXPLANATION
column.
Use the Layout Wizard to create a layout.
Select a New Canvas.
Include all items.
Do not change any prompts.
Set the Style to Tabular.
Set the Frame Title to Stock.
Set the Displayed Records to 4.
Select the Display Scrollbar check box.
In the Object Navigator, rename the canvas to CV_INVENTORY.
In the Object Navigator, move the S_INVENTORY block after the
S_ITEM block.

......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
A-11

Appendix
A: Practice Solutions
......................................................................................................................................................

5 Create a relation called S_Item_S_Inventory explicitly between the

6

7

8

9

S_Item and S_Inventory blocks.
Ensure that line item records can be deleted independently of any related
inventory.
Set the coordination so that the Inventory block is not queried until you
explicitly execute a query.
Create the relation by selecting the word “RELATIONS” in the
S_ITEM block in the Object Navigator and clicking the Create
button. The New Relation dialog box appears. Select
S_INVENTORY as the detail block. Select the Isolated radio button.
Select the Deferred check box, and then uncheck the Auto Query
check box. Enter the join condition s_item.product_id =
s_inventory.product_id and click the OK button.
On the S_ITEM block, change the prompt for the Quantity Shipped item
to Shipped by using the reentrant Layout Wizard. First select the relevant
frame in the Layout Editor, and then use the Layout Wizard.
Select the frame for the S_ITEM block under the CV_ORDER
canvas in the Object Navigator or in the Layout Editor, and select
Tools—>Layout Wizard from the menu.
Select the Items tab page.
Change the prompt for the Quantity Shipped item to Shipped, and
click Finish.
In the S_INVENTORY data block, change the prompt for Amount in
Stock to In Stock by using the Layout Wizard.
In the Object Navigator or in the Layout Editor, select the frame
that is associated with the S_INVENTORY data block.
Select Tools—>Layout Wizard from the menu.
Select the Items tab page and change the prompt for Amount in
Stock to In Stock, and click Finish.
Save and compile your form module.
Run your form module on the Web.
Execute a query.
Navigate through the blocks so that you see the S_INVENTORY block.
Exit the run-time session, close Netscape Communicator, and return to
Form Builder.
No formal solution.
Change the form module name in the Object Navigator to ORDERS and
save.
No formal solution.

......................................................................................................................................................
A-12
Oracle Forms Developer: Build Internet Applications I

Practice 5 Solutions
......................................................................................................................................................

Practice 5 Solutions
CUSTGXX Form
1 Create a control block in the CUSTGXX form.
Create a new block manually, and rename this block CONTROL.
Set the Database Data Block, Query Allowed, Insert Allowed, Update
Allowed, and Delete Allowed Database properties to No. Set the Query
Data Source Type property to None. Leave other properties as default.
Move the CONTROL block after the S_CUSTOMER block.
Select Data Blocks node in the Object Navigator.
Click the Create icon in the Object Navigator, or select
Navigator—>Create option from menu to create a new data block.
Select the “Build a new data block manually” option.
Rename this new data block as CONTROL.
Click the right mouse button on this block, and open the Property
Palette. Find the Database category in the Property Palette.
Set the Database Data Block, Query Allowed, Insert Allowed,
Update Allowed, and Delete Allowed properties to No.
Set the Query Data Source Type property to None.
Leave other properties as default.
In the Object Navigator, move the CONTROL block after the
S_CUSTOMER block.
2 Ensure that the records retrieved in the S_CUSTOMER block are sorted
by the customer’s ID.
In the Property Palette for the S_CUSTOMER block, set the
ORDER BY Clause property to ID.
3 Set the frame properties for the S_CUSTOMER block as follows:
Remove the frame title, and set the Update Layout property to Manually.
In the Layout Editor, select the frame that covers the
S_CUSTOMER block and open the Property Palette. Remove the
Title property value and set the Update Layout property to
Manually.
4 Save and run the CUSTGXX form.
Test the effects of the properties that you have set.
No formal solution.
Note: The Compilation Errors window displays a warning that advises you that the
CONTROL block has no items. This is expected (until you add some items to the
CONTROL block in a later lesson).

......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
A-13

Appendix
A: Practice Solutions
......................................................................................................................................................

ORDGXX Form
5 Create a CONTROL block in the ORDGXX form.
Create a new block manually, and rename this block CONTROL.
Set the Database Data Block, Query Allowed, Insert Allowed, Update
Allowed, and Delete Allowed database properties to No. Set the Query
Data Source Type property to None. Leave other properties as default.
Position the CONTROL block after the S_INVENTORY block in the
Object Navigator.
Select the Data Blocks node in the Object Navigator.
Click the Create icon in the Object Navigator, or select the
Navigator—>Create option from the menu to create a new data
block.
Select the “Build a new data block manually” option.
Rename this new data block CONTROL.
Click the right mouse button on this block, and open the Property
Palette.
Find the Database category in the Property Palette.
Set the Database Data Block, Query Allowed, Insert Allowed,
Update Allowed, and Delete Allowed properties to No.
Set the Query Data Source Type property to None.
Leave other properties as default.
In the Object Navigator, move the CONTROL block after the
S_INVENTORY block.
6 Ensure that the current record is displayed differently from the others in
both the S_ITEM and S_INVENTORY blocks.
Create a visual attribute called Current_Record.
Using the Color Picker, set the foreground color to white and the
background color to dark cyan. (If these colors are not available on your
window manager, use other colors instead.) Using the Pattern Picker,
choose any fill pattern. Using the Font Picker, set the font to MS Serif
italic 10 point. (If that font is not available on your window manager, use
any available font.)
Use the multiple selection feature on both data blocks to set the relevant
block property to use this visual attribute.
In the Object Navigator, select the Visual Attributes node, and
create a new visual attribute.
In the Property Palette, set the Name property to
CURRENT_RECORD.
Select the Foreground Color property and press the button. The

......................................................................................................................................................
A-14
Oracle Forms Developer: Build Internet Applications I

Practice 5 Solutions
......................................................................................................................................................

7

8

9

10

11

Color Picker dialog box is displayed. Set Foreground Color to
White. Repeat the process to set the Background Color to Dark
Cyan.
Select the Fill Pattern property and press the button. The Pattern
Picker dialog box is displayed. Select any pattern.
In the Property Palette, select the Font category heading. (Do not
select any of the properties under the Font category heading.) Click
the More button and the Font dialog box appears. Select MS Serif
italic 10 point, and click the OK button.
In the Object Navigator, to use the multiple selection feature, select
both of the S_ITEM and the S_IVENTORY blocks by pressing the
[Shift] key and the left mouse button, and then open the Property
Palette.
Set the Current Record Visual Attribute Group property to
CURRENT_RECORD.
For the S_ITEM block, change the number of records displayed to 4 and
resize the scroll bar accordingly.
In the Object Navigator, select the S_ITEM block and open the
Property Palette. Set the Number of Records Displayed property
to 4.
Ensure that the records retrieved in the S_ITEM block are sorted by the
ITEM_ID.
For the S_ITEM data block, set the ORDER By Clause property to
ITEM_ID.
Set the property that causes automatic navigation to Next Record, when
the user uses [Next Item] to exit the last item of a record in the S_ITEM
block.
For the S_ITEM block, set the Navigation Style to Change Record.
Set the frame properties for all blocks as follows:
Remove the frame title and set the Update Layout property to Manually.
In the Object Navigator, select frames under the Canvases node and
open the Property Palette. Remove the Title property value and set
the Update Layout property to Manually.
Save and compile the ORDGXX form.
Deploy your form on the Web.
Test the effects of the properties that you have set.
No formal solution.

......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
A-15

Appendix
A: Practice Solutions
......................................................................................................................................................

Practice 6 Solutions
CUSTGXX Form
1 Remove the Region_Id item.
In the Layout Editor, select and delete the Region_Id item.
2 Make sure that the Comments item accepts multiline text to display.
For the Comments item, set Multi-line to Yes and set Height to 65.
3 Automatically display a unique, new customer number for each new
record and ensure that it cannot be changed.
Use the S_CUSTOMER_ID sequence.
For ID, set Initial Value to :sequence.s_customer_id.nextval.
4 In the CUSTGXX form, resize and reposition the items. Reorder the
items in the Object Navigator. Use the screenshot and the following table
as a guide.
Resize items by setting the width according to the following property
table.
Item
ID
NAME
ADDRESS
CITY
STATE
COUNTRY
ZIP_CODE
PHONE
CREDIT_RATING
SALES_REP_ID
COMMENTS

Suggested Width
60
195
195
195
130
195
85
160
65
65
236

......................................................................................................................................................
A-16
Oracle Forms Developer: Build Internet Applications I

Practice 6 Solutions
......................................................................................................................................................

5 Save and compile your form.

Deploy the form on the Web to test the changes.
Note: The entire form may not be visible at this time. This will be
addressed in a later lesson.
No formal solution.

......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
A-17

........... Do not allow insert.. or query operations on this item and make sure that navigation is possible only by means of the mouse.................................. Query Allowed...... Set the Canvas property to CV_ORDER. create a new text item called Item_Total... Ensure that Item_Total is not associated with the S_ITEM table................... 8 Set the relevant property for Date_Ordered........ update.... Create a text item and name it Item_Total........... 9 In the S_ITEM block............. Update Allowed.... so that it displays the current date whenever a new record is entered......... Set the Prompt text to Item Total................. and Keyboard Navigable properties to No...........Appendix A: Practice Solutions .... Do not allow insert. create a new text item called Sales_Rep_Name. or query operations on this item and make sure that navigation is possible only by means of the mouse.... update... For Date_Ordered....... set Initial Value to $$date$$. Create a text item and name it Sales_Rep_Name... Allow numeric data only and display it by using a format of 999G990D99........ Update Allowed...... update............ Display this item on the CV_ORDER canvas. Update Allowed............... Set the Database Item.... create a new text item called Customer_Name... Query Allowed. Ensure that Sales_Rep_Name is not associated with the S_ORD table........................ Query . Set the Prompt text to Sales Rep Name. Create a text item and name it Customer_Name.... 7 In the S_ORD block.... Item Type should be set to Text Item... Set the Prompt text to Customer Name...... Insert Allowed............. and make sure that navigation is possible only by means of the mouse...... Set the Prompt to Sales Rep Name.. Set the Prompt to Customer Name. Insert Allowed.. Item Type should be set to Text Item.. Display this item on the CV_ORDER canvas..... Set the Database Item...... Ensure that Customer_Name is not associated with the S_ORD table.. Do not allow insert.... and Keyboard Navigable properties to No.... Insert Allowed...... A-18 Oracle Forms Developer: Build Internet Applications I ......... Set the Database Item... or query operations on this item... ORDGXX Form 6 In the S_ORD block............. Set the Canvas property to CV_ORDER. Display this item on CV_ORDER canvas. Item Type should be set to Text Item.

................... For Quantity_Shipped.......... Allowed... S_ORD Block Items ID DATE_ORDERED CUSTOMER_ID CUSTOMER_NAME SALES_REP_ID SALES_REP_NAME DATE_SHIPPED PAYMENT_TYPE ORDER_FILLED Suggested Width 40 66 66 116 66 116 66 48 18 S_ITEM Block Items ITEM_ID PRODUCT_ID PRICE QUANTITY QUANTITY_SHIPPED ITEM_TOTAL Suggested Width 20 40 42 26 26 86 Instructor Note Customer_Name and Sales_Rep_Name are created as text items in this course.................... set Justification to Right. ... 10 Justify the values of Price......... 12 In the ORDGXX form.................................... Resize items by setting the width in the corresponding property palette....... set Keyboard Navigable and Update Allowed to No............ Set the Prompt to Item Total............ Display items use less memory than text items..... For each of the items.. Quantity.......... Set the Format Mask to 999G990D99............ Set the Data Type to Number................... Oracle Forms Developer: Build Internet Applications I A-19 ....... Drag and drop items to reposition in navigation order............... 11 Alter the Quantity_Shipped item.. and updates are not allowed..Practice 6 Solutions ............................... They could also be created as display items.. so that navigation is possible only by means of the mouse................................................ resize and reposition the items according to the screenshot and the following table........... and Quantity_Shipped to the right.............. and Keyboard Navigable properties to No. Set the Canvas property to CV_ORDER...........

............................ 13 In the S_INVENTORY block............. alter the number of instances of the Product_ID.............................................................. so that it is displayed just once............Appendix A: Practice Solutions ........................................ .............................................................................................................. set Number of Items Displayed to 1......................... In the property palette for Product_ID...... A-20 Oracle Forms Developer: Build Internet Applications I ..........

.................... 14 Arrange the items and boilerplate on CV_INVENTORY............................................................ Oracle Forms Developer: Build Internet Applications I A-21 .... Hint: Set the Update Layout property for the frame to Manually.................. 15 Save........................................... No formal solution................................Practice 6 Solutions ......... compile................................... No formal solution.. ...................................... and run the form to test the changes.. so that it resembles the screenshot..............................................

.......Appendix A: Practice Solutions . and set both Left and Top to 30.... Click the >> button and then the Next button to select both of the record group values.................... Assign a column width of 25 for ID........... Deploy the form on the Web to test the changes.. Id.......... Set the display width for ID to 25 and click the Next button. Click the Next button to accept the default advanced properties... In the SQL Query Statement.......... Practice 7 Solutions 1 In the ORDGXX form... and assign the LOV a width of 200 and a height of 250....... Assign a title of Products to the LOV............... change the name of the new LOV to PRODUCTS_LOV............... create an LOV to display product numbers and descriptions to be used with the Product_Id item in the S_ITEM block......................PRODUCT_ID and click the OK button. Select the “New Record Group based on a query” radio button............ name s_product name and click the Next button...... ... Click the Next button.. Enter the title Products. Assign the LOV a width of 200 and a height of 250.................... click the “Look up return item” button.................. and click the Next button. 2 Save and compile your form. Create a new LOV...... Click the > button and then the Finish button to create the LOV and attach it to the Product_Id item........... For the ID column.... I want to position it manually” radio button..... Select S_ITEM........... No formal solution...... Click the OK button to use the LOV Wizard..... Change the name of the LOV to PRODUCTS........ enter: SELECT FROM ORDER BY id......... A-22 Oracle Forms Developer: Build Internet Applications I ...... set the return item to S_ITEM....... Select the “No.... Attach the LOV to the Product_Id item in the S_ITEM block................ In the Object Navigator... and Name columns............ Use the S_PRODUCT table........PRODUCT_ID... With the ID column selected................... Position the LOV 30 pixels below and to the right of the upper-left corner..

.... Id............... Set the display width for ID to 20 and click the Next button.. Use the S_EMP table. Assign a title of Sales Representatives to the LOV....... I want to position it manually” radio button.. Enter the title Sales Representatives... Attach the LOV to the Sales_Rep_Id item in the S_CUSTOMER block.. Select the “New Record Group based on a query” radio button...................... Click the >> button and then the Next button to select both of the record group values..SALES_REP_ID and click the OK button. set the return item to S_CUSTOMER................. change the name of the new LOV to SALES_REP_LOV................. 3 In the CUSTGXX form...... and Last_Name columns... Change the name of the LOV to SALES_REP_LOV..... Click the > button and then the Finish button to create the LOV and attach it to the Sales_Rep_Id item. Select the “No...................... Click the Next button. Assign a column width of 20 for ID............... With the ID column selected.............. first_name || ’ ’ || last_name Name From s_emp Where title = ’Sales Representative’ Order By last_name and click the Next button....................SALES_REP_ID..................... Oracle Forms Developer: Build Internet Applications I A-23 . For the ID column... ........Practice 7 Solutions ........... using the LOV Wizard. and set both Left and Top to 30...... First_Name. and click the Next button.............. Select S_CUSTOMER...... enter: Select id.. In the Object Navigator..... Click the Next button to accept the default advanced properties.. Click the OK button to use the LOV Wizard............. Position the LOV 30 pixels below and to the right of the upper-left corner........... Create a new LOV...... and assign the LOV a width of 200 and a height of 250..... Concatenate the First_Name and the Last_Name columns and give an alias such as Name..... create an LOV to display sales representatives’ numbers and their names....... Assign the LOV a width of 200 and a height of 250. click the “Look up return item” button.......................... In the SQL Query Statement....

.... Change the name to Comments_Editor.................. the background color to gray........... Background Color property to gray............................. and the foreground color to yellow. Set the X Position and Y Position properties to 175......... and the Foreground Color property to yellow............... Set the title to Comments.. and run the form to test the changes........... Create a new editor..... Set the Width property to 450 and the Height property to 250................ Set the title to Comments......... 4 In the CUSTGXX form...................... ......Appendix A: Practice Solutions .. set the Editor property to Comments_Editor.......................................... Resize the window if necessary.. In the Property Palette of the Comments item...................................... No formal solution.................. 5 Save........ A-24 Oracle Forms Developer: Build Internet Applications I ... compile......... create an editor and attach it to the Comments item........................................

....... so that the elements do not truncate at run time....... Enter the corresponding database values in the List Item Value box...... In the Layout Editor... Remove the existing prompt and set label as Order Filled. and Excellent.................. Enter the elements Poor........ and EXCELLENT.................. For Order_Filled...... Set the Check Box Mapping of Other Values to Not Allowed........................ Allow only records with Order_Filled values of Y or N to be displayed. Set the Initial Value to N............... Open the Layout Editor and resize the check box so that its label is displayed to the right.. and Excellent to represent database values of POOR............. Good. Set the checked state to represent the base table value of Y and the unchecked state to represent N..... 2 Save and compile the form......... Oracle Forms Developer: Build Internet Applications I A-25 . Set the List Style to Poplist... Set the Value when Checked to Y and Value when Unchecked to N................... Ensure that new records are automatically assigned the value N.........Practice 8 Solutions .. Select the Elements in List property and click the More button to invoke the List Elements dialog box. Good. For Credit_Rating... Add list elements of Poor........ set Item Type to Check Box.. Ensure that new records display the initial value GOOD...... Practice 8 Solutions 1 In the CUSTGXX form........ Open the Layout Editor and resize the item so that elements do not truncate........ Deploy your form on the Web to test the changes.... Resize the poplist in the Layout Editor..... ............... No formal solution............... set Item Type to List Item... Delete the Prompt property................ Set the Mapping of Other Values to POOR............. Display any other values as POOR... convert the Order_Filled text item to a check box.... GOOD............ Click OK to accept and close the dialog. set the Label property to Order Filled............ convert the Credit_Rating text item into a pop-up list item.......... resize the check box so that its label is displayed to the right. 3 In the ORDGXX form..... Set the Initial Value to GOOD.........

.................. Expand the Payment_Type node................. Use the Layout Editor to position the radio buttons so that both can be seen........................... For the second button.... 6 Save...... In the Layout Editor... For the first button............ For Payment_Type..................... create boilerplate text to identify radio buttons as Payment Type................. Set the Initial Value to CASH............ Define access keys of S for cash and T for credit. Label to Cash........................................ set Item Type to Radio Group....Appendix A: Practice Solutions ....... Label to Credit..... No formal solution........ Add radio buttons for Cash and Credit to represent database values of CASH and CREDIT.................. Create two buttons....... and run the form to test the changes.......... Set Label to Cash for the Cash radio button and Credit for the Credit radio button.... 5 Reorder the items of the S_ORD block in the Object Navigator.......... Use the order of the items in the Layout Editor as a guide................ Ensure that new records display the default of Cash.............. and Radio Button Value to CASH.............. set Access Key to S.. 4 Convert the Payment_Type text item into a radio group..... compile....... and Radio Button Value to CREDIT... . set Access Key to T.. Add text Payment type to describe the radio group’s purpose..... Drag the items of the S_ORD block according to the visual order of this block. A-26 Oracle Forms Developer: Build Internet Applications I ..... name them Cash_Button and Credit_Button..... The Radio Buttons node is displayed.

.................. Database Item: No......................Practice 9 Solutions . Display the Layout Editor......... create a display item called Description... Set the Name property to Description............. ensure that the block is set to S_ITEM.... Set the Maximum Length to 50.. Set the Maximum Length property to 50......... Set the Prompt property to Description and display the prompt above the item.............. Keyboard Navigable: No. Set the Width to 133. Ensure that the block is set to S_ITEM.................................. Practice 9 Solutions 1 In the S_ITEM block of the ORDGXX form...... Place the Display Item to the right of the Product_Id. Change the name to Product_Image... Set the Maximum Length property to the same value as the Description item..... 2 Create a single-record image item called Product_Image in the S_ITEM block of the ORDGXX form...... Select the Display Item tool. Place the Display Item to just below the Product_Image... in the S_ITEM block....... This should synchronize with the Description item...... Number of Items Displayed: 1. Click and drag a box and place it so that it matches the screenshot below....................... Set the Synchronize with Item to Description...... Change the name to Image_Description. Ensure that the block is set to S_ITEM...................... and select the Display Item tool.. Set the Prompt property to Description and the Prompt Attachment Edge property to Top... Image_Description............. Set the Width to 133.... Set the Database Item to No.... Display the Property Palette for the image... Select the Image Item tool.... Display the Layout Editor.... Set the Database Item to No.... Sizing Style: Adjust....... Include these properties for the image item: Bevel: Lowered......... Oracle Forms Developer: Build Internet Applications I A-27 ............... ..................... 3 Create another display item.. Set the Number of Items Displayed to 1....... Open the Layout Editor................

.. create an iconic button called Product_LOV_Button....ico or ...................quantity_shipped * :S_ITEM.............. In the Object Navigator... 5 To display item total information.. Set the Formula property to :S_ITEM.. 6 To display the total of the item totals..price..... Set the Number of Items Displayed property to 1......... Ensure that you have set the Query All Records property to Yes for the S_ITEM block.......... Set the Keyboard Navigable property to No........ Set the Justification property to Right.... Set the Justification property to Right....... create a new nondatabase item in the S_ITEM block.... Set the Iconic property to Yes.... and open the Property Palette.. Set the Keyboard Navigable property to No..................... Make S_ITEM..Appendix A: Practice Solutions ......... A-28 Oracle Forms Developer: Build Internet Applications I ........... 4 In the CONTROL block of the ORDGXX form.....total a summary item and display summaries of the item_total values in the S_ITEM block............... Select the Push Button tool.. Create a push button and place it close to the Product_Id................ select the Item_Total item in the S_ITEM block.............price........ Set the Keyboard Navigable property and the Mouse Navigate property to No............... Use the list file (do not include the . and set the Icon File Name to List........... Resize the push button......... Set the Format Mask property to 9G999G990D99. Set the Formula property to :S_ITEM.............gif extension).............quantity_shipped * :S_ITEM........... Set the Name to Product_LOV_Button... Set the Keyboard Navigable property to No. Set the Mouse Navigate property to No............ set the following properties for the Item_Total item in the S_ITEM block: Set the Justification property to right.............. . Set the Calculation Mode property to Formula.. and Prompt properties according to the screenshot................... Set the Calculation Mode property to Formula... Set the Position...... Display the Layout Editor and ensure that the block is set to CONTROL.. Size...

. Calculation Mode property to Summary................. Set the X Position....... and run the form to test the changes.......... .. Set the Keyboard Navigable property to No................... Set the Query All Records property to Yes for the S_ITEM block....... Set the Canvas property to CV_ORDER............... that is necessary for summary items.............. Oracle Forms Developer: Build Internet Applications I A-29 ..... For S_ITEM.......... Change the window size if necessary...................Practice 9 Solutions ............ and the Prompt property to Order Total... compile............... Set the Number of Items Displayed property to 1.. create a new text item in the S_ITEM block................ Y Position... Set the Summarized Block property to S_ITEM and Summarized Item property to item_total............. In the Object Navigator.............. and Width properties according to the screenshot..........................total item.................... No formal solution..................... 7 Save......... set Database Item property to No.......... and Summary Function property to Sum. Set the Keyboard Navigable property to No...... Set the Name property to TOTAL.... Set the Data Type property to Number. Set the Justification property to Right... Set the Format Mask property to 9G999G990D99.......................

.......................................................Appendix A: Practice Solutions .... ......... A-30 Oracle Forms Developer: Build Internet Applications I ............................................................................................................................................................................. 8 Perform a query in the ORDGXX form to ensure that the new items do not cause an error.................................. Did you remember to switch off the Database Item property for items that do not correspond to columns in the base table? No formal solution............................

................ Deploy the form on the Web to test the changes.................... the iconic button will have a different image than the same iconic button in the client-server environment. Select the Push Button tool.............. This is because the image stored in list. Oracle Forms Developer: Build Internet Applications I A-31 ............ico or ......... Set Keyboard Navigable to No........ and place it next to Sales_Rep_ID......... Set Mouse Navigate to No........... 10 Save and compile the form....................ico............. Use the list file (do not include the ............................... No formal solution... Resize the push button....gif extension)... Set Iconic to Yes........ Set Icon File Name to List.................Practice 9 Solutions ................. Set Name to Sales_Rep_LOV_Button....... Note: When you test the form on the Web.......... in the CONTROL block of form CUSTGXX..... Name the push button Sales_Rep_Lov_Button.. Create a push button and place it close to Sales_Rep_ID....gif is different from the image stored in list...... 9 Create an iconic button similar to the one created in question 4................................. Display the Layout Editor and ensure that the block is set to CONTROL.... .....................................

. Also change its title to Orders and Items.. Set the canvas Window property to WIN_INVENTORY............ Set Hide on Exit to Yes..... Y 30................. In the ORDGXX form.. create a new window called WIN_INVENTORY suitable for displaying the CV_INVENTORY canvas. Use the rulers in the Layout Editor to help you plan the height and width of the window.....Appendix A: Practice Solutions ....... Associate the CV_INVENTORY canvas with the window WIN_INVENTORY............................. Modify the window in the ORDGXX form..................... The suggested size is Width 460.......................... Deploy the form on the Web and ensure that the S_INVENTORY block is displayed in WIN_INVENTORY when you navigate to this block...... In the Layout Editor... Change the height.. Set the Title property to Orders and Items. Height 340...... ....... Check that the size and position are suitable................... The suggested size is Width 360........ The suggested position is X 60..... Set the window title to Stock Levels and Hide on Exit property to Yes... Set the Name property of the existing window to WIN_ORDER..... Compile and run the form on the Web. Place the new window in a suitable position relative to WIN_ORDER..... No formal solution.. The suggested X...... and title in the Property Palette..... Save the form......... No formal solution....... A-32 Oracle Forms Developer: Build Internet Applications I ..... compile..... Save..... Compile the form..................... Height 360............ Create a new window called WIN_INVENTORY............ Set the size. Y positions are 10...... and change its title to Customer Information... and plan the height and width for the window. Change the name of the 2 3 4 5 6 window to WIN_CUSTOMER..... Practice 10 Solutions 1 Modify the window in the CUSTGXX form...... position..... and title of the window in the Property Palette. 10. and run the form to test the changes........ width.... Ensure that the window is called WIN_ORDER........... Change the Title property to Customer Information. look at the lowest and rightmost positions of objects on the canvas......

........................ compile.......... In the WIN_ORDER Property Palette of the window....... Create three push buttons in the CONTROL block. and make it the standard toolbar for that window...................... Push Button Name Stock_Button Show_Help_Button Exit_Button Details Label: Stock Mouse Navigate: No Keyboard Navigable: No Canvas: Toolbar Label: Show Help Mouse Navigate: No Keyboard Navigable: No Canvas: Toolbar Label: Exit Mouse Navigate: No Keyboard Navigable: No Canvas: Toolbar Suggested positions for the push buttons are shown in the following illustration: .... as detailed below.. create a horizontal toolbar canvas called Toolbar in the WIN_ORDER window.... Set Canvas Type to Horizontal Toolbar and Window to WIN_ORDER................................................................. Practice 11 Solutions Toolbar Canvases 1 In the ORDGXX form.................. No formal solution........................ Suggested height is 30...... and run the form to test............................................ No formal solution.................... Notice that the toolbar now uses part of the window space. Oracle Forms Developer: Build Internet Applications I A-33 ....... Set Name to Toolbar and Height to 30................ set Horizontal Toolbar Canvas to Toolbar............... Adjust the window size accordingly.... Create a new canvas.... 2 Save.Practice 11 Solutions .................... and place them on the Toolbar canvas.

. (This ensures the correct stacking order at run time....... Create a new canvas... Viewport Height 215 (points).. 100. click the new canvas object in the Object Navigator and select Tools—>Property Palette.. while showing CV_ORDER..... Suggested visible size is Viewport Width 270........ In the Layout Editor. Define the Viewport X and Viewport Y Positions in the Property Palette............................. A-34 Oracle Forms Developer: Build Internet Applications I .Appendix A: Practice Solutions .. Do not move the view in the Layout Editor............. Set the Canvas Type to Stacked...... providing that it does not obscure the current item in the form... Assign it to the WIN_ORDER window..... 2 Position the view of the stacked canvas so that it appears in the center of WIN_ORDER.. Suggested coordinates: 100.......... Stacked Canvases 1 Create a stacked canvas named CV_HELP to display help in the WIN_ORDER window of the ORDGXX form.......... and select CV_HELP from the list........................) Drag the Help_Canvas so that it is the last canvas displayed under the Canvases node................ . Place some application help text on this canvas.............. display the CV_ORDER canvas and select View—>Stack Views from the menu..... Ensure that it will not obscure the first enterable item..................... Name the canvas CV_HELP...... You can see both canvases in this way............. Display the stacked canvas in the Layout Editor......................... 3 Organize CV_HELP so that it is the last canvas in sequence.... Do this by planning the top-left position of the view in the Layout Editor................................. 4 Save and compile the form....... If the Property Palette is not already displayed............. No formal solution................. Note that the stacked canvas is displayed all the time....... Deploy the form on the Web to test the changes.... Change Viewport X and Viewport Y properties in the Property Palette for CV_Help Canvas....... and create some boilerplate text objects with help information about the form... Do this in the Object Navigator....

................... Display this push button on the CV_HELP canvas......................................................... and then create a push button in the CONTROL block to hide the Help information when it is no longer needed................... You will add the code later......................................................... 5 Switch off the Visible property of CV_HELP....................................................... Create a push button in the CONTROL block with the following properties: Push Button Name Hide_Help_Button Details Label: Hide Help...............Practice 11 Solutions ...... Canvas: CV_HELP Mouse Navigate: No .............. Oracle Forms Developer: Build Internet Applications I A-35 ...... Set the Visible Property to No for the CV_HELP...........................................................

Billing.. ZIP_CODE.. Set the Canvas property to TAB_CUSTOMER........ 2 Rename the TAB_CUSTOMER tab canvas........ set the Background Color property to gray................ COUNTRY............ Tab Canvases Modify the CUSTGXX form in order to use a tab canvas: 1 In the Layout Editor... and Comments....Appendix A: Practice Solutions ....................... ADDRESS.......... expand this tab canvas and create three tab pages....... Click the Tab canvas button in the toolbar and create a tab canvas...... select NAME.... Set the Tab Page property to the tab page that is labeled Address............ set the Background Color property to gray............ and Comments..... Billing..... In the Layout Editor....... In the Object Navigator........................ In the Object Navigator. Tab style property to Square.................... In the Layout Editor. CITY.................... and Bevel property to None.... Set the item properties to make them visible on the relevant tab pages..... STATE.. In the Layout Editor... 3 Design the tab pages according to the following screenshots........ select this tab canvas and open the Property Palette... In the Object Navigator............. Create three tab pages and label them as Address. Corner Style property to Square.... and PHONE items of the S_CUSTOMER block and open the Property Palette for this multiple selection............... Create a tab canvas....... Set the tab pages label properties as Address....... ......... arrange the items according to the following screenshot........... Set the Name property to TAB_CUSTOMER..... select the frame that covers S_CUSTOMER block and delete.... delete the frame object that covers the S_CUSTOMER block... and Bevel property to None...... A-36 Oracle Forms Developer: Build Internet Applications I ..... In the Property Palette..............

............................................................. ...............................................................................................................................................................Practice 11 Solutions .................................. Oracle Forms Developer: Build Internet Applications I A-37 ...............................................

................... select the CREDIT_RATING and SALES_REP_ID items of the S_CUSTOMER block and the SALES_REP_LOV button of the CONTROL block..................................................................... .. In the Layout Editor........................................................................ Set the Canvas property to TAB_CUSTOMER............. Set the Tab Page property to the tab page that is labeled Billing...... A-38 Oracle Forms Developer: Build Internet Applications I ..........................Appendix A: Practice Solutions ... In the Object Navigator.. Open the Property Palette for this multiple selection............................................................... arrange the items according to the screenshot.................................

.................. select the COMMENTS item of the S_CUSTOMER block.............. In the Layout Editor...................................... Set the Tab Page property to the tab page that is labeled Comments................................................................. Set the Canvas property to TAB_CUSTOMER........ ........................................................ and open the Property Palette................. In the Object Navigator.......................................Practice 11 Solutions .................................... resize the COMMENTS item according to the screenshot................ Oracle Forms Developer: Build Internet Applications I A-39 .

.................... Ensure that the user does not move from one tab page to another when tabbing through items...................... No formal solution...... 5 Save and compile the form................... For example................ ......................... Set the Next Navigation Item and Previous Navigation Item properties according to the order of items in the tab pages.............................................. for the Phone item....................... set the Previous Navigation Item property to ZIP_CODE and the Next Navigation Item property to NAME........................Appendix A: Practice Solutions ..................................................... Deploy the form on the Web................ Set the Previous Navigation Item and Next Navigation Items properties for items in the S_CUSTOMER block according to their order in the tab pages............... A-40 Oracle Forms Developer: Build Internet Applications I ........................ 4 Reorder the items according to the tab page sequence..

.................... select Smart triggers in the pop-up menu....... use the Smart triggers feature..... Find the relevant built-in in the Object Navigator under built-in packages...Practice 13 Solutions ............. compile.............. and run the form.... END IF............................ 3 Save............................. and select the When-Button-Pressed trigger from the list........... No formal solution.............. .... When-Button-Pressed on CONTROL........ and use the “Paste Name and Arguments” feature.... 4 In the ORDGXX form............... 5 Write a trigger that exits the form when the Exit_Button is selected...................Sales_Rep_Lov_Button: IF SHOW_LOV(’sales_rep_lov’) THEN NULL. END IF. No formal solution..... write a trigger to display the Products_Lov when the Products_Lov_Button is selected....... When-Window-Closed at the form level: EXIT_FORM... 2 Create a When-Window-Closed trigger at the form level in order to exit form... Oracle Forms Developer: Build Internet Applications I A-41 .................Exit_Button: EXIT_FORM....... To create the When-Button-Pressed trigger....... When-Button-Pressed on CONTROL........... compile................ 6 Save....... press the right mouse button........ When-Button-Pressed on CONTROL....... Select the Sales_Rep_Lov_Button in the Object Navigator. and run the form......Products_Lov_Button: IF SHOW_LOV(’products_lov’) THEN NULL. Practice 13 Solutions 1 In the CUSTGXX form............. write a trigger to display the Sales_Rep_Lov when the Sales_Rep_Lov_Button is selected.............

CV_HELP.... You might decide to advertise Help only while the cursor is in certain items..Show_Help_Button: SHOW_VIEW(’CV_HELP’)....... The stacked canvas... 9 Save and compile the form................................ of course......... The CV_HELP canvas..................Appendix A: Practice Solutions .. at least.. Deploy the ORDGXX form on the Web to test.Stock_Button: GO_BLOCK(’S_INVENTORY’).....Hide_Help_Button that hides the CV_HELP.Hide_Help_Button HIDE_VIEW(’CV_HELP’).... .............. When-Button-Pressed on CONTROL.. could also be shown in its own window......... 8 Create a When-Button-Pressed trigger on CONTROL.... is displayed only if the current item will not be obscured........................................... When-Button-Pressed on CONTROL................... 10 Create a When-Button-Pressed trigger on CONTROL.....Stock_Button that uses the GO_BLOCK built-in to display the S_INVENTORY block.. A-42 Oracle Forms Developer: Build Internet Applications I ........................................... Use the HIDE_VIEW built-in to achieve this... No formal solution......................... that the first entered item in the form is one that will not be obscured by CV_HELP................. Ensure.... 7 Create a When-Button-Pressed trigger on CONTROL....... or move the stacked canvas to a position that does not overlay enterable items................Show_Help_Button that uses the SHOW_VIEW built-in to display the CV_HELP........... When-Button-Pressed on CONTROL............ if appropriate...

....................Sales_Lov_Button in order to call this procedure.............................txt file: PROCEDURE list_of_values(p_lov in VARCHAR2....................FMB file........ Try stepping through the code to monitor its progress................ 2 Modify the When-Button-Pressed trigger of CONTROL................ ..Sales_Lov_Button: LIST_OF_VALUES(’SALES_REP_LOV’........... Practice 14 Solutions 1 Open your CUSTGXX......Practice 14 Solutions ..................................... 3 Compile and run your form in Debug mode.... ELSE MESSAGE(’You have just cancelled the List of Values’)............ Set a breakpoint in one of your triggers..... create a procedure that is called List_Of_Values.. No formal solution.... Oracle Forms Developer: Build Internet Applications I A-43 ......fmb for the completed form...................p_text in VARCHAR2) IS v_lov BOOLEAN.... You can use CUSTWK14.. BEGIN v_lov:= SHOW_LOV(p_lov)..... When-Button-Pressed on CONTROL.. Import code from the pr14_1.......... IF v_lov = TRUE THEN MESSAGE(’You have just selected a ’||p_text)........................ In this form................ END IF.. END.............. ’Sales Representative’)............ and investigate the call stack.................

... Display the Layout Editor...... create a new button called Image_Button and position it on the toolbar.................... . Set the Label property to Image Off...........payment_type := ’CASH’................ Set the Canvas property to Toolbar. Practice 15 Solutions 1 In the ORDGXX form.......................credit_rating%type....customer_id = id...txt file...................... END IF.....Appendix A: Practice Solutions .... END..... Set the Name to Image_Button...... A-44 Oracle Forms Developer: Build Internet Applications I ........ BEGIN IF :S_ORD....... IF v_credit NOT IN(’GOOD’................. Open the PL/SQL Editor and select File—>Import Text..... MESSAGE(’This customer must pay cash’)............... END IF........... You can import the pr15_1............. Select the Button tool.’EXCELLENT’) THEN :S_ORD............ 2 In the CONTROL block..................................payment_type = ’CREDIT’ THEN SELECT credit_rating INTO v_credit FROM S_CUSTOMER WHERE :S_ORD................................ Set the Keyboard Navigable property to No. write a trigger that fires when the payment type changes..... Create a button and place it on the toolbar..... Set the Mouse Navigate property to No............ When-Radio-Changed on S_ORD. Set the Label property to Image Off......Payment_Type: DECLARE v_credit s_customer.. allowing only those customers with a good or excellent credit rating to pay for orders on credit..............

However....... ELSE SET_ITEM_PROPERTY(’S_ITEM. VISIBLE..... When-Button-Pressed on Control....... The file contains code that determines the current value of the visible property of the Product Image item.....image_description’......... PROPERTY_FALSE)....product_image’...... SET_ITEM_PROPERTY(’S_ITEM............ VISIBLE......... If the current value is True........image_description’......... PROPERTY_TRUE)... .......... SET_ITEM_PROPERTY(’S_ITEM...... No formal solution. the visible property toggles to False for both the Product Image item and the Image Description item............... VISIBLE.image_button’...product_image’.... Deploy the form on the Web.... if the visible property is currently False............ ’Image Off’)....Practice 15 Solutions .... Oracle Forms Developer: Build Internet Applications I A-45 ...image_button’........... VISIBLE)=’TRUE’ THEN SET_ITEM_PROPERTY(’S_ITEM...................... END IF.......................product_image’.....Image_Button: IF GET_ITEM_PROPERTY(’S_ITEM... 4 Save and compile the form.. Finally..... the visible property toggles to True for both the Product Image item and the Image Description item. SET_ITEM_PROPERTY(’CONTROL.. PROPERTY_FALSE).........’Image On’)............ 3 Import the pr15_3...... VISIBLE.. SET_ITEM_PROPERTY(’CONTROL........txt file into a trigger that fires when the Image_Button is clicked............... LABEL................... Open the PL/SQL Editor and select File—>Import Text... LABEL..... the label changes on the Image_Button to reflect its next toggle state............... PROPERTY_TRUE).......................

.......................... n := SHOW_ALERT(’payment_type_alert’).......Appendix A: Practice Solutions .. Set Name to PAYMENT_TYPE_ALERT.. Set Name to QUESTION_ALERT. Set Alert Style to Caution... The message should read “This customer must pay cash!” Create an alert............. END..Payment_Type: DECLARE n NUMBER.. Set Button1 Label to OK.................. Set Message to “This customer must pay cash!” Remove the labels for the other buttons.... 3 Create a generic alert called Question_Alert that allows Yes and No replies. Set Alert Style to Stop............ BEGIN IF :S_ORDER..... Set Button2 Label to No.......... Set Button1 Label to Yes. 2 Alter the When-Radio-Changed trigger on Payment_Type to show the Payment_Type_Alert instead of the message when a customer must pay cash................... Set Title to Question.......... A-46 Oracle Forms Developer: Build Internet Applications I ......payment_type = ’CREDIT’ THEN SELECT credit_rating INTO v_credit FROM S_CUSTOMER WHERE :S_ORD. v_credit S_CUSTOMER...... When-Radio-Changed on S_ORD...................... Set Title to Payment Type...........................customer_id = id..... END IF. Create an alert................... IF v_credit not in(’GOOD’.... ................................ Practice 16 Solutions 1 Create an alert in ORDGXX called Payment_Type_Alert with a single OK button...................’EXCELLENT’) THEN :S_ORD................................. END IF.........payment_type := ’CASH’.....credit_rating%type...

.............Exit_Button that uses Question_Alert to ask the operator to confirm that the form should terminate................... ................................................................ 5 Save and compile the form............................................Exit_Button: SET_ALERT_PROPERTY(’Question_Alert’........... Deploy the form on the Web to test........................Practice 16 Solutions ........... ALERT_MESSAGE_TEXT... 4 Alter the When-Button-Pressed trigger on CONTROL..... IF SHOW_ALERT(’Question_Alert’) = ALERT_BUTTON1 THEN EXIT_FORM...... When-Button-Pressed on CONTROL.......... ’Do you really want to leave the form?’)....... No formal solution............................... Oracle Forms Developer: Build Internet Applications I A-47 ..................... END IF...........................................

.............................................................. write a trigger that populates the Customer_Name and the Sales_Rep_Name for every row fetched by a query on the S_ORD block.......last_name INTO :S_ORD.id........description FROM S_PRODUCT WHERE :S_ITEM...........id = C. Ensure that the When-Radio-Changed trigger has no effect in Enter Query mode... Practice 17 Solutions 1 In the ORDGXX form. Post-Query on S_ORD block: SELECT C...... Set Fire in Enter Query Mode property to No for the When-Button-Pressed trigger................ Post-Query on S_ITEM block: SELECT name INTO :S_ITEM. 3 Ensure that the Exit_Button has no effect in Enter Query mode.........sales_rep_id AND :S_ORD.... .................................product_id = id............... A-48 Oracle Forms Developer: Build Internet Applications I ...... E..............................customer_id = C..........name..............customer_name.......................... Set Fire in Enter Query Mode property to No for the When-RadioChanged trigger...... 2 Write a trigger that populates the Description for every row fetched by a query on the S_ITEM block.................. :S_ORD....................sales_rep_name FROM S_CUSTOMER C....Appendix A: Practice Solutions ......... S_EMP E WHERE E..

................. PROPERTY_FALSE).......... 4 Adjust the default query interface.. END IF............ ............ CASE_INSENSITIVE_QUERY........... Open the CUSTOMERS form module.. 5 Add a check box called CONTROL.........txt file into the Pre-Query Trigger....... Set the initial value property to Y... Pre-Query trigger on the S_CUSTOMER block: IF NVL( :CONTROL....Exact_Match as shown below) to the CONTROL block and create the following trigger...... Add another check box (called CONTROL...Case_Sensitive to the form so that the user can specify whether or not a query for a customer name should be case sensitive.. END IF........................name := ’%’ || :S_CUSTOMER................name’..) You can import the pr17_5.. (If a nonexact match is allowed............name’................... Set the Mouse Navigate property to No.... Add a check box called CONTROL......... Set the Mouse Navigate property to No.................. ’Y’) = ’Y’ THEN SET_ITEM_PROPERTY(’S_CUSTOMER.........name || ’%’....... In the CONTROL block...... When-Checkbox-Changed trigger on the CONTROL......... and create the following trigger.......Exact_Match to the form so that the user can specify whether or not a query condition for a customer name should exactly match the table value...........exact_match. ’Y’ ) = ’N’ THEN :S_CUSTOMER.txt file into the When-Checkbox-Changed trigger........... You can import the pr17_4. ELSE SET_ITEM_PROPERTY(’S_CUSTOMER....... the search value can be part of the table value. PROPERTY_TRUE)...CASE_INSENSITIVE_QUERY.......... Set the initial value property to “Y”.. add a check box (called CONTROL.......case_sensitive............................. Oracle Forms Developer: Build Internet Applications I A-49 ......Case_Sensitive as shown below) to it..Practice 17 Solutions ..Case_Sensitive item (checkbox): IF NVL(:CONTROL...

. When-Validate-Record on S_ORD block: IF :S_ORD..... Deploy the form on the Web to test........id = C.......sales_rep_id AND :S_ORD..... Practice 18 Solutions 1 In the CUSTGXX form........... C.last_name INTO :S_ORD. END IF.. cause the Sales_Rep_Lov to be displayed whenever the user enters a Sales_Rep_Id that does not exist in the database....Customer_Id: SELECT C........... E..........date_shipped < :S_ORD. RAISE form_trigger_failure.......... ......................... 3 In the ORDGXX form.............name..customer_name......... S_EMP E WHERE E................ :S_ORD............. When-Validate-Item on S_ORD.....customer_id = C. write a validation trigger to check that the Date_Shipped is not before the Date_Ordered.... Set the Validate from List property to Yes for the Sales_Rep_Id item in the S_CUSTOMER block.. 4 In the ORDGXX form.....date_ordered THEN MESSAGE(’Ship date is before order date!’)......... and Sales_Rep_Id items whenever validation occurs on Customer_Id..........id.. Sales_Rep_Name............sales_rep_name FROM S_CUSTOMER C.... :S_ORD............................................. create a trigger to write the correct values to the Customer_Name............... EXCEPTION WHEN NO_DATA_FOUND THEN MESSAGE(’Invalid Customer Id’)... A-50 Oracle Forms Developer: Build Internet Applications I .. No formal solution.........sales_rep_id.. Fail the trigger if the customer is not found....sales_rep_id....Appendix A: Practice Solutions .................. 2 Save and compile the form..... RAISE form_trigger_failure......................

.................................................... Fail the trigger and display a message if the product is not found.......Practice 18 Solutions ....................Product_Id to derive the name of the product and suggested wholesale price..... ............................................................. :S_ITEM....... When-Validate-Item on S_ITEM.. Oracle Forms Developer: Build Internet Applications I A-51 .. RAISE form_trigger_failure............................................................price FROM S_PRODUCT WHERE :S_ITEM......... EXCEPTION WHEN NO_DATA_FOUND THEN MESSAGE(’Invalid Product Id!’).............product_id = id.............. 5 Create another validation trigger on S_ITEM.............. and write them to the Description item and the Price item. suggested_whlsl_price INTO :S_ITEM.............................Product_Id: SELECT name.........description.........

............. IF filename = ’No file’ THEN null... s_product WHERE s_image.......Appendix A: Practice Solutions ................ BEGIN filename := GET_PRODUCT_IMAGE(:S_ITEM..... if one exists...image_id AND s_product.....product_id)........................ END.....id = s_product.............. When-New-Form-Instance at form level: EXECUTE_QUERY......’S_ITEM............... END IF.... A-52 Oracle Forms Developer: Build Internet Applications I ....filename INTO v_filename FROM s_image..............................id = product_number......................... and populate the Product_Image item with a picture of the product..... This function returns the image filename for the given product number. FUNCTION get_product_image (product_number IN NUMBER) RETURN VARCHAR2 IS v_filename VARCHAR2(20). RETURN v_filename............... Get_Product_Image function is already created for you.............................. ELSE READ_IMAGE_FILE(filename................ Practice 19 Solutions 1 Write a When-New-Form-Instance trigger on the ORDGXX form to execute a query at form startup.. 2 Write a trigger that fires as the cursor arrives in each record of the S_ITEM block.................... IF v_filename is null THEN v_filename := ’No file’...... .....’tiff’....... END IF..... BEGIN SELECT s_image......product_image’).................. END........ EXCEPTION WHEN no_data_found THEN return(’No file’).... When-New-Record-Instance on S_ITEM block: DECLARE filename VARCHAR2(20)..

.........Product_Id is a candidate for the code..................... 4 Is there another trigger where you might also want to place this code? When-Validate-Item on S_ITEM.......... Use the same code above...............................Practice 19 Solutions ........... When-New-Record-Instance on S_ORD block.................. Oracle Forms Developer: Build Internet Applications I A-53 ........................... Deploy the form on the Web to test. 3 Define the same trigger type and code on the S_ORD block............................ No formal solution........................................... ........ You could use a procedure to avoid duplicating the trigger code............................... 5 Save and compile the form........................................................................

..Id. Deploy the form on the Web to test...........DUAL........................... write a transactional trigger on the S_ORD block that populates S_ORD..... .. No formal solution....... Pre-Insert on S_ORD block: SELECT S_ORD_ID.... The better solution is to keep the total number of rows in another table that you can lock.....Id with the next value from the S_ORD_ID sequence... In the Property Palette.. 2 In the S_ORD block...nextval INTO :S_ORD... 5 Save and compile the form......... Set the Required and Enabled properties to No for S_ITEM.................. set Enabled property to No for S_ORD.......................id FROM SYS. No formal solution.......... EXCEPTION WHEN OTHERS THEN MESSAGE(’Failed to assign Order Id’)........... Pre-Insert on S_ITEM block: SELECT NVL(MAX(item_id)........ set the Enabled property for the ID item to No...Appendix A: Practice Solutions ... but this solution is too advanced at this stage............. RAISE form_trigger_failure. Practice 20 Solutions 1 In the ORDGXX form........ A-54 Oracle Forms Developer: Build Internet Applications I ..............0) + 1 INTO :S_ITEM..... compile........ and run the form to test................ord_id = ord_id.........item_id FROM S_ITEM WHERE :S_ITEM............ 4 Create a similar trigger on the S_ITEM block that assigns the Item_Id when a new record is saved...............................................Item_Id.................. Instructor Note Solution 20-4 is not the safest way... 3 Save.................

..... :GLOBAL.... Create three global variables called GLOBAL........update’)...................... updates. Post-Insert at form level: DEFAULT_VALUE(’0’......... ..........update ) + 1 )....UPDATE.....................insert’). Oracle Forms Developer: Build Internet Applications I A-55 .................................. Post-Delete at form level: DEFAULT_VALUE(’0’. These variables indicate respectively the number of inserts..................... :GLOBAL....................update := TO_CHAR( TO_NUMBER( :GLOBAL. ’GLOBAL. You need to write Post-Insert..............insert := TO_CHAR( TO_NUMBER( :GLOBAL..... and deletes...... and Post-Delete triggers to initialize and increment the value of each global variable........INSERT.......delete ) + 1 ).... ’GLOBAL.............................DELETE......... 6 Open the CUSTGXX form module............... Post-Update at form level: DEFAULT_VALUE(’0’......Practice 20 Solutions ........insert ) + 1 )....delete’)........................ ’GLOBAL..delete := TO_CHAR( TO_NUMBER( :GLOBAL... :GLOBAL.... Post-Update............ and GLOBAL.. GLOBAL.......

...... Call the procedure when a message occurs............update || ’ records updated...... MESSAGE(’Save Ok: ’ || :GLOBAL.Appendix A: Practice Solutions ............. Call the procedure when an error occurs.. Pass the error code and TRUE............. FALSE )..... IS_ERROR IN BOOLEAN ) IS BEGIN IF message_number IN ( 40400.......... The first one is a message number............ ’GLOBAL....txt file.. 40407 ) THEN DEFAULT_VALUE( ’0’.... END ..... 40406.... On-Error at form level: handle_message( error_code. This procedure receives two arguments.... ’ || :GLOBAL. A-56 Oracle Forms Developer: Build Internet Applications I .delete’ )............ On-Message at form level: handle_message( message_code................ 7 Create a procedure called HANDLE_MESSAGE...... .. Import the pr20_10.... ELSE MESSAGE( MESSAGE_TEXT )... ’GLOBAL......... This procedure uses the three global variables to display a customized commit message and then erases the global variables........... END IF.............................delete || ’ records deleted !!!’ ).... Pass the message code and FALSE.................................... TRUE )................. DEFAULT_VALUE( ’0’......................... ’GLOBAL..................insert’ )...update’ )....... ’ || :GLOBAL.. and the second is a Boolean error indicator.......... ELSIF is_error = TRUE THEN MESSAGE(’ERROR: ’ || ERROR_TEXT )..insert || ’ records inserted..... DEFAULT_VALUE( ’0’. PROCEDURE handle_message( message_number IN NUMBER..........

......... On-Logon at form level: DECLARE connected BOOLEAN := FALSE.. END......Practice 20 Solutions ... You can import the pr20_11. cs := GET_APPLICATION_PROPERTY( CONNECT_STRING ).. un VARCHAR2(30).............................. Write an On-Logon trigger to control the number of connection tries.................. pw || ’@’ || cs...... WHILE connected = FALSE and tries > 0 LOOP LOGON_SCREEN................ pw VARCHAR2(30)............ tries NUMBER := 3........... .............. ’DEFAULT’).... tries := tries . END IF............. 8 Open the CUSTGXX form module..... IF NOT CONNECTED THEN MESSAGE(’Too many tries!’).................................. IF FORM_SUCCESS THEN connected := TRUE ... FALSE )...... cs VARCHAR2(30)..............1....... Use the LOGON_SCREEN built-in to simulate the default login screen and LOGON to connect to the database.......... un := GET_APPLICATION_PROPERTY( USERNAME )............ pw := GET_APPLICATION_PROPERTY( PASSWORD )....... BEGIN SET_APPLICATION_PROPERTY(CURSOR_STYLE........ RAISE FORM_TRIGGER_FAILURE....................txt file..... END LOOP........................... Oracle Forms Developer: Build Internet Applications I A-57 ......... LOGON( un..... END IF.........

.... ’S_ITEM............. Add a test in the code to check Product_Image...... ELSE READ_IMAGE_FILE(filename.................... END IF................. IF filename = ’No file’ THEN null....product_image’)...... alter the triggers that populate the Product_Image item when the image item is displayed............... END IF.............................................product_image’........ END... ...................................................................................... Perform the trigger actions only if the image is currently displayed... A-58 Oracle Forms Developer: Build Internet Applications I .........Appendix A: Practice Solutions ...................’tiff’................VISIBLE)=’TRUE’ THEN filename := GET_PRODUCT_IMAGE(:S_ITEM..............product_id). Use the GET_ITEM_PROPERTY built-in function. BEGIN IF GET_ITEM_PROPERTY(’S_ITEM.... When-New-Record-Instance on S_ORD and S_ITEM blocks: DECLARE filename VARCHAR2(20)............ Practice 21 Solutions 1 In the ORDGXX form.............

...........LABEL..........LABEL..............VISIBLE...... and run the form to test these features.. 3 Save... and use them in each item reference in the trigger........... ’Image Off’).......image_description’)...... ’Image On’).......... END..........image_button’)..... BEGIN IF GET_ITEM_PROPERTY(product_image_id.. compile.... PROPERTY_TRUE)...image_button: DECLARE product_image_id ITEM := FIND_ITEM(’S_ITEM......... VISIBLE........................ ELSE SET_ITEM_PROPERTY(product_image_id.............................. SET_ITEM_PROPERTY(image_button_id.... .. image_desc_id ITEM := FIND_ITEM(’S_ITEM...................... END IF.... Declare variables for these IDs........ VISIBLE)=’TRUE’ THEN SET_ITEM_PROPERTY(product_image_id............ SET_ITEM_PROPERTY(image_desc_id.... SET_ITEM_PROPERTY(image_button_id.. VISIBLE............. Oracle Forms Developer: Build Internet Applications I A-59 ....... No formal solution...... Use a FIND_object function to obtain the IDs of each item referenced by the trigger.. SET_ITEM_PROPERTY(image_desc_id.......product_image’)..........Practice 21 Solutions ...... When-Button-Pressed on CONTROL... image_button_id ITEM := FIND_ITEM(’CONTROL.... PROPERTY_FALSE)..... 2 Alter the When-Button-Pressed trigger on the Image_Button so that object IDs are used............PROPERTY_TRUE).............. VISIBLE...........PROPERTY_FALSE)............

.......... Select the Copy options........ select the Subclass Information property... called Stock_Objects. Drag Stock_Objects from the ORDERS form to your new module under the Object Groups node.. Set the properties to the values listed above. In the Property Palette for each of the items................. and click the More button... 4 In the new form module............................ Select the Object Groups node and click the Create icon........... A-60 Oracle Forms Developer: Build Internet Applications I ... Include the following properties and settings: Property Font Name Format Mask Font Size Justification Delete Allowed Background Color Setting Arial 99.......... Select the Forms node and click the Create icon..................... 5 Apply ClassA to CV_INVENTORY... consisting of the S_INVENTORY block.............. and WIN_INVENTORY window under the Object Group Children entry............. select the Property Class radio button and set the Property Class Name list item to ClassA.... 2 Save the form................... Add the properties listed by clicking the Add Property icon and selecting from the list displayed....... and the Max_In_Stock item.. Practice 22 Solutions 1 In the ORDGXX form.....Appendix A: Practice Solutions ...............999 8 Right No DarkRed Select the Property Classes node and click the Create icon. create a property class called ClassA. create an object group....... In the Subclass Information dialog box..................... Drag the S_INVENTORY block........ ...................... In the Property Palette for the property class.... and WIN_INVENTORY window.. No formal solution........ CV_INVENTORY canvas. the Restock_Date item............................ CV_INVENTORY canvas............ 3 Create a new form module and copy the Stock_Objects object group into it.. set the Name to ClassA................

. the Toolbar............ Product_Lov_Button......... and click the Create button......... Select the Object Libraries node in the Object Navigator.... compile...... You should receive the following error: Invalid format mask for given datatype for S_INVENTORY... and run the form. Save... Correct the error...... Set the Horizontal Toolbar Canvas property to TOOLBAR for the window. see the DEPTWK22 file for a solution. Show_Help_Button.. Stock_Button... Oracle Forms Developer: Build Internet Applications I A-61 .. and the Question_Alert to the personal tab of the object library......Practice 22 Solutions ...olb. Use Toolbar as the Horizontal Toolbar canvas for this form..................... Subclass the objects...... Set their label properties as Personal and Corporate. Save.............. 6 Save the form module as STOCKXX.. and create a data block based on the S_DEPT table. Make the Restock_Date format mask a variant property. the Toolbar.Restock_Date.. and run the form to test it. compile.................... Drag the Toolbar canvas......Product_Id From the Copy Value From Item property.... For proper behavior... and run the form 7 8 9 10 and note the error..fmb.................... compile... the S_DEPT block must be before the CONTROL block in the Object Navigator. CONTROL block. Save the object library as summit........... Create an object library and name it summit..................... You should receive the following error: Cannot resolve reference item reference s_ITEM. Create a new form......... Create two tabs in the object library called Personal and Corporate........... Expand the Library Tabs node in the Object Navigator..Product_Id Delete s_ITEM........ . Change the Format Mask for S_INVENTORY................ Some items are not applicable to this form.............. Save this form as DEPTGXX. and run the form again... Set the Canvas property for the following items to NULL: Image_Button.... and Question_Alert from the object library into the new form........ Hide_Help_Button. Save the summit object library..... Drag the CONTROL block.. Set the Window property to WINDOW1 for the Toolbar canvas. Add the CONTROL block....... Follow the practice steps......... compile... and the Question_Alert to the Personal tab of the object library............ Rename this object library summit.....Restock_Date to MM/DD/YYYY....................

.......................... Create a sample date field... Drag these items into your object library................ Place the Toolbar canvas in the new form........................................................ ..... A-62 Oracle Forms Developer: Build Internet Applications I .......................Appendix A: Practice Solutions ................................... Set the width and the format mask to your preferred standard........................................... one for wide buttons and one for medium buttons...... 11 Try to delete items on the Null canvas... No formal solution.................. 12 Create two sample buttons.. Create a new form and a new data block in the form.. What happens and why? You cannot delete the objects because the toolbar and contents are subclassed from another object................................................ by means of width.................. Apply these SmartClasses in your form. Mark these items as SmartClasses.........

..Orders_Button that initializes GLOBAL.... OPEN_FORM(’ordgxx’)......customer_id := :S_CUSTOMER.. When-Button-Pressed on CONTROL.. if required............ No formal solution.............. create a Pre-Form trigger to ensure that a global variable called Customer_Id exists............... and run the form to test that it works as a stand-alone.... 5 Define a trigger for CONTROL...... 7 Change the window location of the ORDGXX form.........................customer_id...id........................... No formal solution....... Oracle Forms Developer: Build Internet Applications I A-63 .......... create a CONTROL block button called Orders_Button. No formal solution........ .................... Pre-Form at form level: DEFAULT_VALUE(’’.....Orders_Button: :GLOBAL.......Customer_Id Pre-Query on S_ORD block: :S_ORD.. Set Label to Orders..customer_id’). 6 Save and compile each form.Practice 23 Solutions ................ 2 Add a trigger to ensure that queries on the S_ORD block are restricted by the value of GLOBAL....... 3 Save........................ Deploy the application to the Web......customer_id := :GLOBAL........... Create a button.. passing control to it........... compile....... and then opens the ORDGXX form............ Practice 23 Solutions 1 In the ORDGXX form.... Set the Name to ORDERS_BUTTON... 4 In the CUSTGXX form................’GLOBAL...................Customer_Id with the current customer’s ID...........

...... ELSE GO_FORM(’ORDERS’).. When-Button-Pressed on Orders_Button: :GLOBAL..................... END IF................id.............................. Use the FIND_FORM built-in for this purpose......customer_id := :S_CUSTOMER.........Appendix A: Practice Solutions ...... Remember that you need to use the module name in the GO_FORM built-in..... 8 Alter the Orders_Button trigger in CUSTGXX so that it uses GO_FORM to pass control to ORDGXX if the form is already running.........................customer_id.....................customer_id := :S_CUSTOMER....Id: :GLOBAL............Customer_Id as the default value for S_ORD.. ........... When-Create-Record on S_ORD block: :S_ORD.....id. 10 Add code to the CUSTGXX form so that GLOBAL.......... IF ID_NULL(FIND_FORM(’ORDERS’))THEN OPEN_FORM(’ORDGXX’)..................... 9 Write a When-Create-Record trigger on the S_ORD block that uses the value of GLOBAL..... A-64 Oracle Forms Developer: Build Internet Applications I ....................Customer_Id is updated when the current Customer_Id changes.................................customer_id := :GLOBAL........................... When-Validate-Item on S_CUSTOMER.Customer_Id......... and the filename in the OPEN_FORM built-in...............

............ Table Descriptions and Data ...............B ......

........Appendix B: Table Descriptions and Data .... Summit Sporting Goods Database Diagram ORD_ID ID S_ITEM PRODUCT_ID S_ORD CUSTOMER_ID SALES_REP_ID * S_INVENTORY PRODUCT_ID ID ID ID S_CUSTOMER S_PRODUCT SALES_REP_ID IMAGE_ID ID S_IMAGE ID ID S_EMP DEPT_ID ID S_DEPT *Unique occurrences are identified by PRODUCT_ID and WAREHOUSE_ID........................................................................................................................... B-2 Oracle Forms Developer: Build Internet Applications I ................... ...................................................................................................................................................

.....................................................................--------ID NAME PHONE ADDRESS CITY STATE COUNTRY ZIP_CODE CREDIT_RATING SALES_REP_ID REGION_ID COMMENTS Null? ------------NOT NULL NOT NULL Datatype ----------------NUMBER(7) VARCHAR2(50) VARCHAR2(25) VARCHAR2(400) VARCHAR2(30) VARCHAR2(20) VARCHAR2(30) VARCHAR2(75) VARCHAR2(9) NUMBER(7) NUMBER(7) VARCHAR2(255) ................................................................................ S_CUSTOMER Description Column Name -------------............................S_CUSTOMER Description ........................................................... Oracle Forms Developer: Build Internet Applications I B-3 .................................................................

Japan Poor 14 4 Customer should always pay by cash until his credit rating improves.............. Id Name Phone Address ----------------------.........................----------City State Country -----------------.................................................................... S_CUSTOMER Data SQL> SELECT * FROM s_customer.......Appendix B: Table Descriptions and Data .. 203 Delhi Sports 91-10351 11368 Chanakya New Delhi India Good 14 4 Customer specializes in baseball equipment and is the largest retailer in India.................... B-4 Oracle Forms Developer: Build Internet Applications I ...-----------................................................................ This is okay as long as the credit rating remains excellent.......................--------Comments -------------------------------------------------201 Unisports 55-2066101 72 Via Bahia Sao Paolo Brazil Excellent 12 2 Customer usually orders large amounts and has a high order total.....................-------------------------Zip_code Credit_ra Sales_rep_id Region_id ----------------------------.............. ................................... 202 Osaka Oj Athletics 81-20101 6741 Takashi Blvd..............

..............................-----------............ Oracle Forms Developer: Build Internet Applications I B-5 ...............................................................................................................................-------------------------Zip_code Credit_ra Sales_rep_id Region_id ----------------------------.......................................... 207 Lagos Sweet Rock Sports 234-603620 6 Saint Antoine Nigeria ............. S_CUSTOMER Data (continued) Id Name Phone Address ----------------------.............--------Comments -------------------------------------------------204 Womansport 1-206-104-0103 281 King Street Seattle Washington USA 98101 EXCELLENT 11 1 205 Hong Kong Kam’s Sporting Goods 852-3692888 15 Henessey Road EXCELLENT 15 4 206 Cannes Sportique 33-2257201 172 Rue de Rivoli France EXCELLENT 15 5 Customer specializes in soccer............. Likes to order accessories in bright colors.....S_CUSTOMER Data ....................----------City State Country -----------------...............................

........ 209 Beisbol Si! San Pedro de Macon’s EXCELLENT 809-352689 11 789 Playa Del Mar Dominican Republic 1 210 Futbol Sonora 52-404562 3 Via Saguaro Nogales EXCELLENT 12 2 Customer is difficult to reach by phone.....................-----------.............................................................. B-6 Oracle Forms Developer: Build Internet Applications I .............. S_CUSTOMER Data (continued) Id Name Phone Address ----------------------.....----------City State Country -----------------..............Appendix B: Table Descriptions and Data .... Try mail........................................................................................................................................... 211 Prague Kuhn’s Sports EXCELLENT 42-111292 15 7 Modrany Czechoslovakia 5 ..............--------Comments -------------------------------------------------208 Muench Sports 49-527454 435 Gruenestrasse Stuttgart Germany GOOD 15 5 Customer usually pays small orders by cash and large orders on credit....................-------------------------Zip_code Credit_ra Sales_rep_id Region_id ----------------------------......

......................S_CUSTOMER Data ................ Insist upon cash. Note: This display has been formatted....-------------------------Zip_code Credit_ra Sales_rep_id Region_id ----------------------------.......--------Comments -------------------------------------------------212 Hamada Sport 20-1209211 57A Corniche Alexandria Egypt EXCELLENT 13 3 Customer orders sea and water equipment............. 213 Big John’s Sports 1-415-555-6281 4783 18th Street Emporium San Francisco CA USA 94117 EXCELLENT 11 1 Customer has a dependable credit record......................... but has difficulty paying bills.......................... 214 Ojibway Retail Buffalo NY 14202 POOR 1-716-555-7171 415 Main Street USA 11 1 215 Sporta Russia 7-3892456 6000 Yekatamina St.....-----------.................................................................. Oracle Forms Developer: Build Internet Applications I B-7 ......................----------City State Country -----------------.... Petersburg Russia POOR 15 5 This customer is very friendly..................................... S_CUSTOMER Data (continued) Id Name Phone Address ----------------------.................................................... ...........

.......................................................................................... ID -----10 31 32 33 34 35 41 42 43 44 45 50 NAME ---------------Finance Sales Sales Sales Sales Sales Operations Operations Operations Operations Operations Administration REGION_ID ----------------1 1 2 3 4 5 1 2 3 4 5 1 12 rows selected............... ..........................................Appendix B: Table Descriptions and Data ........................................ B-8 Oracle Forms Developer: Build Internet Applications I ................................... S_DEPT Description and Data Column Name ---------------------ID NAME REGION_ID Null? ------------NOT NULL NOT NULL Datatype -------------NUMBER(7) VARCHAR2(25) NUMBER(7) SQL> SELECT * FROM s_dept................................................................................

................................................................................................. Oracle Forms Developer: Build Internet Applications I B-9 ................................................2) ................................. S_EMP Description Column Name -----------------------ID LAST_NAME FIRST_NAME USERID START_DATE COMMENT MANAGER_ID TITLE DEPT_ID SALARY COMMISSION_PCT Null? -------------NOT NULL NOT NULL Datatype -------------NUMBER(7) VARCHAR2(25) VARCHAR2(25) VARCHAR2(8) DATE VARCHAR2(255) NUMBER(7) VARCHAR2(25) NUMBER(7) NUMBER(11...................................S_EMP Description ..............................................2) NUMBER(4...........................................

.........................Appendix B: Table Descriptions and Data ............................... ID LAST_NAME FIRST_NAME USERID START_DAT ---............... Operations 41 1450 3 Nagayama 1 VP......-----COMMISSION_PCT --------------1 Velasquez Carmen cvelasqu 03-MAR-90 President 50 2500 2 Ngao LaDoris lngao 08-MAR-90 1 VP............---------------------------------.............................. Sales 4 Quick-To-See Mark 1 VP.............. S_EMP Data SQL> SELECT * FROM s_emp......................................... B-10 Oracle Forms Developer: Build Internet Applications I ............................----------------............................................ Administration aropebur 04-MAR-90 50 1550 6 Urguhart Molly 2 Warehouse Manager murguhar 18-JAN-91 41 1200 7 Menchu Roberta 2 Warehouse Manager Biri Ben 2 Warehouse Manager rmenchu 14-MAY-90 42 1250 bbiri 07-APR-90 43 1100 Catchpole Antoinette 2 Warehouse Manager acatchpo 09-FEB-92 44 1300 8 9 Midori mnagayam 17-JUN-91 31 1400 ....----------------------................ Finance mquickto 07-APR-90 10 1450 5 Ropeburn Audry 1 VP.......--------COMMENTS -------------------------------------------------------------MANAGER_ID TITLE DEPT_ID SALARY ---------.....................................

----------------................................................................... S_EMP Data (continued) ID LAST_NAME FIRST_NAME USERID START_DAT ---..................................5 adumas 09-OCT-91 35 1450 16 Maduro Elena 6 Stock Clerk emaduro 07-FEB-92 41 1400 ..........................5 hgiljum 18-JAN-92 32 1490 13 Sedeghi Yasmin 3 Sales Representative 10 ysedeghi 18-FEB-91 33 1515 14 Nguyen Mai 3 Sales Representative 15 mnguyen 22-JAN-92 34 1525 15 Dumas Andre 3 Sales Representative 17.................................... Oracle Forms Developer: Build Internet Applications I B-11 .......--------COMMENTS -------------------------------------------------------------MANAGER_ID TITLE DEPT_ID SALARY ---------.............-----COMMISSION_PCT --------------10 Havel Marta mhavel 27-FEB-91 2 Warehouse Manager 45 1307 11 Magee Colin 3 Sales Representative 10 cmagee 14-MAY-90 31 1400 12 Giljum Henry 3 Sales Representative 12.........................................---------------------------------.........----------------------...............S_EMP Data ...........................................................

..........................................----------------.......--------COMMENTS -------------------------------------------------------------MANAGER_ID TITLE DEPT_ID SALARY ---------......Appendix B: Table Descriptions and Data ................---------------------------------.. S_EMP Data (continued) ID LAST_NAME FIRST_NAME USERID START_DAT ---........ ..............-----COMMISSION_PCT --------------17 Smith George gsmith 08-MAR-90 6 Stock Clerk 41 940 18 Nozaki Akira 7 Stock Clerk anozaki 09-FEB-91 42 1200 19 Patel Vikram 7 Stock Clerk vpatel 06-AUG-91 42 795 20 Newman Chad 8 Stock Clerk cnewman 21-JUL-91 43 750 21 Markarian Alexander 8 Stock Clerk amarkari 26-MAY-91 43 850 22 Chang Eddie 9 Stock Clerk echang 30-NOV-90 44 800 23 Patel Radha 9 Stock Clerk rpatel 17-OCT-90 34 795 24 Dancs Bela 10 Stock Clerk bdancs 17-MAR-91 45 860 25 Schwartz Sylvie 10 Stock Clerk sschwart 09-MAY-91 45 1100 Note: This display has been formatted...........................................................................----------------------............ B-12 Oracle Forms Developer: Build Internet Applications I ............................................................................................................................

..tif curlbar................ S_IMAGE Description and Data Name Null? Type -----------------------------....S_IMAGE Description and Data ...................tif aceboot................................tif baseball.....................tif acepole.. .......-------....... ID ----1001 1002 1003 1011 1012 1013 1291 1296 1829 1381 1382 1119 1223 1367 1368 1369 1480 1482 1486 FORMAT ----------------------JTIFF JTIFF JTIFF JTIFF JTIFF JTIFF JTIFF JTIFF JTIFF JTIFF JTIFF JTIFF JTIFF JTIFF JTIFF JTIFF JTIFF JTIFF JTIFF U Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y FILENAME I ---------------------------...........................tif cabbat...........................tif stglove............tif propole...........................tif safthelm............tif grglove............tif winbat.tif 19 rows selected..........bunboot...........tif himbike..tif proboot.....tif bunpole. Note: The above output has been formatted............ Oracle Forms Developer: Build Internet Applications I B-13 ....tif pucbat........---ID NOT NULL NUMBER(7) FORMAT VARCHAR2(25) USE_FILENAME VARCHAR2(1) FILENAME VARCHAR2(255) IMAGE LONG RAW SQL> SELECT * FROM s_image......tif alglove....tif probar............tif chaphelm......tif gpbike................

...........-----------OUT_OF_STOCK RESTOCK_D ------------------------...............................................................--------.........................-----------OUT_OF_STOCK RESTOCK_D ------------------------....................................................--------....................--------....... PRODUCT_ID WAREHOUSE AMT_IN_STOCK REORD_PT MAX_IN_STOCK ---------...................Appendix B: Table Descriptions and Data ......................................................-----------.........................--------10011 101 650 625 1100 10012 101 600 560 1000 10013 101 400 400 700 10021 101 500 425 740 10022 101 300 200 350 10023 101 400 300 525 20106 101 993 625 1000 PRODUCT_ID WAREHOUSE AMT_IN_STOCK REORD_PT MAX_IN_STOCK ---------..............-----------.--------20108 101 700 700 1225 20201 101 802 800 1400 20510 101 1389 850 1400 20512 101 850 850 1450 30321 101 2000 1500 2500 30326 101 2100 2000 3500 .. S_INVENTORY Description and Data Name --------------------------------PRODUCT_ID WAREHOUSE_ID AMOUNT_IN_STOCK REORDER_POINT MAX_IN_STOCK OUT_OF_STOCK_EXPLANATION RESTOCK_DATE Null? -------NOT NULL NOT NULL Type ---NUMBER(7) NUMBER(7) NUMBER(9) NUMBER(9) NUMBER(9) VARCHAR2(255) DATE SQL> SELECT * FROM s_inventory.--------....... B-14 Oracle Forms Developer: Build Internet Applications I ..........

.........-----------OUT_OF_STOCK RESTOCK_D ------------------------........................................................-----------......-----------..--------.............................--------..... S_INVENTORY Description and Data (Continued) PRODUCT_ID WAREHOUSE AMT_IN_STOCK REORD_PT MAX_IN_STOCK ---------....--------30421 101 1822 1800 3150 30426 101 2250 2000 3500 30433 101 650 600 1050 32779 101 2120 1250 2200 32861 101 505 500 875 40421 101 578 350 600 PRODUCT_ID WAREHOUSE AMT_IN_STOCK REORD_PT MAX_IN_STOCK ---------.--------......S_INVENTORY Description and Data ........... 12-APR-93 ...................--------................................--------.....................................................-----------OUT_OF_STOCK RESTOCK_D ------------------------............--------50273 101 233 200 350 50417 101 518 500 875 50418 101 244 100 275 50419 101 230 120 310 50530 101 669 400 700 50532 101 0 100 175 Wait for Spring........ Oracle Forms Developer: Build Internet Applications I B-15 .. 08-FEB-93 41010 101 250 250 437 41020 101 471 450 750 41050 101 501 450 750 41080 101 400 400 700 41100 101 350 350 600 50169 101 2530 1500 2600 PRODUCT_ID WAREHOUSE AMT_IN_STOCK REORD_PT MAX_IN_STOCK ---------..........................--------40422 101 0 350 600 Phenomenal sales....................-----------OUT_OF_STOCK RESTOCK_D ------------------------....-----------..--------............

S_INVENTORY Description and Data (Continued) PRODUCT_ID WAREHOUSE AMT_IN_STOCK REORD_PT MAX_IN_STOCK ---------............-----------OUT_OF_STOCK RESTOCK_D ------------------------........--------..........-----------................--------...................--------...................-----------..................--------50536 101 173 100 175 20106 201 220 150 260 20108 201 166 150 260 20201 201 320 200 350 20510 201 175 100 175 20512 201 162 100 175 PRODUCT_ID WAREHOUSE AMT_IN_STOCK REORD_PT MAX_IN_STOCK ---------..................-----------OUT_OF_STOCK RESTOCK_D ------------------------....................--------50169 201 225 220 385 50273 201 75 60 100 50417 201 82 60 100 50418 201 98 60 100 50419 201 77 60 100 50530 201 62 60 100 .--------.....................................Appendix B: Table Descriptions and Data ...........................................................--------..-----------............--------30321 201 96 80 140 30326 201 147 120 210 30421 201 102 80 140 30426 201 200 120 210 30433 201 130 130 230 32779 201 180 150 260 32861 201 132 80 140 PRODUCT_ID WAREHOUSE AMT_IN_STOCK REORD_PT MAX_IN_STOCK ---------.... B-16 Oracle Forms Developer: Build Internet Applications I ...................-----------OUT_OF_STOCK RESTOCK_D ------------------------...................................--------......

.......................................-----------.............-----------OUT_OF_STOCK RESTOCK_D ------------------------.........................................--------.. S_INVENTORY Description and Data (Continued) PRODUCT_ID WAREHOUSE AMT_IN_STOCK REORD_PT MAX_IN_STOCK ---------...........--------30433 301 35 20 35 32779 301 102 95 175 32861 301 57 50 100 40421 301 70 40 70 40422 301 65 40 70 41010 301 59 40 70 41020 301 61 40 70 PRODUCT_ID WAREHOUSE AMT_IN_STOCK REORD_PT MAX_IN_STOCK ---------......--------.......--------41050 301 49 40 70 41080 301 50 40 70 41100 301 42 40 70 20510 401 88 50 100 20512 401 75 75 140 30321 401 102 80 140 ..... Oracle Forms Developer: Build Internet Applications I B-17 ..................--------.......-----------..........................--------......-----------..........S_INVENTORY Description and Data .............--------50532 201 67 60 100 50536 201 97 60 100 20510 301 69 40 100 20512 301 28 20 50 30321 301 85 80 140 30421 301 102 80 140 PRODUCT_ID WAREHOUSE AMT_IN_STOCK REORD_PT MAX_IN_STOCK ---------...............................................-----------OUT_OF_STOCK RESTOCK_D ------------------------.....................................-----------OUT_OF_STOCK RESTOCK_D ------------------------........--------...--------................

.......--------.............-----------...--------30326 401 113 80 140 30421 401 85 80 140 30426 401 135 80 140 30433 401 0 100 175 A defective shipment was 07-SEP-92 sent to Hong Kong and nee ded to be returned.......................... The s oonest ACME can turn this around is early February 32779 401 135 100 175 PRODUCT_ID WAREHOUSE AMT_IN_STOCK REORD_PT MAX_IN_STOCK ---------.................................Appendix B: Table Descriptions and Data ..............--------................................--------32861 401 250 150 250 40421 401 47 40 70 40422 401 50 40 70 41010 401 80 70 220 41020 401 91 70 220 41050 401 169 70 220 ................... S_INVENTORY Description and Data (Continued) PRODUCT_ID WAREHOUSE AMT_IN_STOCK REORD_PT MAX_IN_STOCK ---------..............................................................--------.-----------..........--------..................................-----------OUT_OF_STOCK RESTOCK_D ------------------------....................... B-18 Oracle Forms Developer: Build Internet Applications I ............-----------OUT_OF_STOCK RESTOCK_D ------------------------......................

......-----------OUT_OF_STOCK RESTOCK_D ------------------------....................--------41080 401 100 70 220 41100 401 75 70 220 50169 401 240 200 350 50273 401 224 150 280 50417 401 130 120 210 50418 401 156 100 175 PRODUCT_ID WAREHOUSE AMT_IN_STOCK REORD_PT MAX_IN_STOCK ---------.....--------.............--------.....................................................--------...........--------.......S_INVENTORY Description and Data ..--------..-----------OUT_OF_STOCK RESTOCK_D ------------------------......--------10023 10501 500 300 525 20106 10501 150 100 175 20108 10501 222 200 350 20201 10501 275 200 350 20510 10501 57 50 87 20512 10501 62 50 87 ................................--------50419 401 151 150 280 50530 401 119 100 175 50532 401 233 200 350 50536 401 138 100 175 10012 10501 300 300 525 10013 10501 314 300 525 10022 10501 502 300 525 PRODUCT_ID WAREHOUSE AMT_IN_STOCK REORD_PT MAX_IN_STOCK ---------........................................-----------...... Oracle Forms Developer: Build Internet Applications I B-19 ............-----------OUT_OF_STOCK RESTOCK_D ------------------------..............--------....................-----------...............................-----------......................... S_INVENTORY Description and Data (Continued) PRODUCT_ID WAREHOUSE AMT_IN_STOCK REORD_PT MAX_IN_STOCK ---------..........

--------41100 10501 141 140 245 114 rows selected..........-----------...--------....-----------.............. ........--------....................................................-----------OUT_OF_STOCK RESTOCK_D ------------------------....-----------......--------................Appendix B: Table Descriptions and Data .. Note: The above output has been formatted.............................--------32861 10501 288 200 350 40421 10501 97 80 140 40422 10501 90 80 140 41010 10501 151 140 245 41020 10501 224 140 245 41050 10501 157 140 245 41080 10501 159 140 245 PRODUCT_ID WAREHOUSE AMT_IN_STOCK REORD_PT MAX_IN_STOCK ---------..........--------.........................-----------OUT_OF_STOCK RESTOCK_D ------------------------. B-20 Oracle Forms Developer: Build Internet Applications I ....--------30321 10501 194 150 275 30326 10501 277 250 440 30421 10501 190 150 275 30426 10501 423 250 450 30433 10501 273 200 350 32779 10501 280 200 350 PRODUCT_ID WAREHOUSE AMT_IN_STOCK REORD_PT MAX_IN_STOCK ---------....-----------OUT_OF_STOCK RESTOCK_D ------------------------........................--------.........................................................--------.... S_INVENTORY Description and Data (Continued) PRODUCT_ID WAREHOUSE AMT_IN_STOCK REORD_PT MAX_IN_STOCK ---------........................................

.......................... Oracle Forms Developer: Build Internet Applications I B-21 .................................................................................................................................................................... S_ITEM Description Column Name ------------------------ORD_ID ITEM_ID PRODUCT_ID PRICE QUANTITY QUANTITY_SHIPPED Null? -------------NOT NULL NOT NULL NOT NULL Datatype ---------NUMBER(7) NUMBER(7) NUMBER(7) NUMBER(11...............................................................S_ITEM Description ............2) NUMBER(9) NUMBER(9) ....................................

.......................................................................................----------------135 500 500 380 400 400 14 500 500 582 600 600 8 250 250 20 450 450 36 400 400 16 15 15 8 20 20 4........-------....................Appendix B: Table Descriptions and Data ......................................................................... ORD_ID -----100 100 100 100 100 100 100 101 101 101 101 101 101 101 102 102 103 103 104 104 104 104 105 105 105 ITEM_ID -------1 2 3 5 7 6 4 1 3 5 6 7 4 2 1 2 1 2 1 4 2 3 1 3 2 PRODUCT_ID ----------10011 10013 10021 30326 41010 30433 10023 30421 41010 50169 50417 50530 41100 40422 20108 202011 30433 32779 20510 30421 20512 30321 50273 50532 50419 PRICE QUANTITY QUANTITY_SHIPPED -----.............. S_ITEM Data SQL> SELECT * FROM s_item........29 40 40 80 27 27 45 50 50 45 35 35 50 30 30 28 100 100 23 45 45 20 15 15 7 11 11 9 7 7 16 35 35 8 12 12 1669 19 19 22.....................8 16 16 47 28 28 80 13 13 ................................... B-22 Oracle Forms Developer: Build Internet Applications I .......................................

.........-------.............................. Note: This display has been formatted.89 75 75 75 98 98 80 27 27 123 21 21 4........----------------28 46 46 22................................................................................................ Oracle Forms Developer: Build Internet Applications I B-23 .........................................................89 17 17 50 23 23 65 27 27 35 29 29 9 1000 1000 500 50 50 5 7 7 9 18 18 8 25 25 80 53 53 45 69 69 11 50 50 62 rows selected.. ........25 500 500 75 43 43 60 50 50 582 1500 1500 175 600 600 21.......................95 300 300 22........................................29 125 125 11 50 50 115 130 130 16 55 55 1669 75 75 28 22 22 9 9 9 35 50 50 45 42 42 60 57 57 8 18 18 7 60 60 1669 85 85 140 150 150 18................S_ITEM Data ........ S_ITEM Data (continued) ORD_ID ------106 106 106 106 106 106 107 107 107 107 107 108 108 108 108 108 108 108 109 109 109 109 109 109 109 110 110 111 111 97 97 98 99 99 99 99 112 ITEM_ID ------1 4 5 6 2 3 1 3 5 4 2 1 6 7 5 2 4 3 1 5 7 6 4 2 3 1 2 1 2 1 2 1 1 2 3 4 1 PRODUCT_ID ----------20108 50273 50418 50419 20201 50169 20106 20201 30421 30321 20108 20510 41080 41100 32861 20512 32779 30321 10011 30426 50418 32861 30326 10012 10022 50273 50536 40421 41080 20106 303211 404218 20510 20512 50417 50530 20106 PRICE QUANTITY QUANTITY_SHIPPED -----...........

........2) VARCHAR2(6) VARCHAR2(1) SQL> SELECT * FROM s_ord..----------- --------- ---------------------------------- ------ 100 101 102 103 104 105 106 107 108 109 110 111 97 98 99 112 31-AUG92 31-AUG-92 01-SEP-92 02-SEP-92 03-SEP-92 04-SEP-92 07-SEP-92 07-SEP-92 07-SEP-92 08-SEP-92 09-SEP-92 09-SEP-92 28-AUG-92 31-AUG-92 31-AUG-92 31-AUG-92 10-SEP-9211 15-SEP-9214 08-SEP-9215 22-SEP-9215 23-SEP-9215 18-SEP-9211 15-SEP-9212 21-SEP-9215 10-SEP-9213 28-SEP-9211 21-SEP-9211 21-SEP-9211 17-SEP-9212 10-SEP-9214 18-SEP-9214 10-SEP-9212 Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y 204 205 206 208 208 209 210 211 212 213 214 204 201 202 203 210 601100 8056.......... ID CUSTOMER_ID DATE_ORDE DATE_SHIPSALES_REP_IDTOTAL PAYMEN ORDER_F --......................................................Appendix B: Table Descriptions and Data ....................................6 8335 377 32430 2722.............................................................................13 2770 84000 595 7707 550 CREDIT CREDIT CREDIT CASH CREDIT CREDIT CREDIT CREDIT CREDIT CREDIT CASH CASH CREDIT CASH CREDIT CREDIT 16 rows selected.............................. S_ORD Description and Data Column Name -----------------------ID CUSTOMER_ID DATE_ORDERED DATE_SHIPPED SALES_REP_ID TOTAL PAYMENT_TYPE ORDER_FILLED Null? -----NOT NULL NOT NULL Datatype --------------------NUMBER(7) NUMBER(7) DATE DATE NUMBER(7) NUMBER(11...24 15634 142171 149570 1020935 1539........ ............................................................. B-24 Oracle Forms Developer: Build Internet Applications I ..................

......... S_PRODUCT Description Column Name Null? ---------------------------------ID NOT NULL NAMENOT NULL SHORT_DESC LONGTEXT_ID IMAGE_ID SUGGESTED_WHLSL_PRICE WHLSL_UNITS Datatype ----------------NUMBER(7) VARCHAR2(50) VARCHAR2(255) NUMBER(7) NUMBER(7) NUMBER(11.................................................... Oracle Forms Developer: Build Internet Applications I B-25 .....................................................................................................................................................................................S_PRODUCT Description ......................................................2) VARCHAR2(25) .....

.......................................................... ID ---IMAGE_ID -------10011 1001 NAME SHORT_DESC LONGTEXT_ID -----------------------------------SUGGESTED_WHLSL_PRICEWHLSL_UNITS -------------------------------Boot Beginner’s ski boot 518 150 10012 1002 Ace Ski BootIntermediate ski boot519 200 10013 1003 Pro Ski BootAdvanced ski boot 410 10021 1011 Bunny Ski PoleBeginner’s ski pole528 16......................................................................................95 20106 Junior Soccer BallJunior soccer ball613 11 520 530 20108 World Cup Soccer BallWorld cup soccer ball615 28 20201 World Cup NetWorld cup net 123 708 ............................95 10023 1013 Pro Ski PoleAdvanced ski pole 40....... B-26 Oracle Forms Developer: Build Internet Applications I .........................25 10022 1012 Ace Ski PoleIntermediate ski pole529 21............................ S_PRODUCT Data SQL> SELECT * FROM s_product....Appendix B: Table Descriptions and Data ....................................................................

..--------------------------------------IMAGE_IDSUGGESTED_WHLSL_PRICEWHLSL_UNITS ---------------------------------------20510 Black Hawk Knee pads............................................S_PRODUCT Data ................... S_PRODUCT Data (continued) ID NAME SHORT_DESC LONGTEXT_ID ---............................................. Oracle Forms Developer: Build Internet Applications I B-27 ...............................25 30433New Air PumpTire pump 20 940 32779 Slaker Water Water bottle Bottle 7 1286 32861 Safe-T HelmetBicycle helmet 1829 60 1368 40421 Alexeyer ProStraight bar Lifting Bar 1381 65 928 40422 Pro Curling BarCurling bar 1382 50 929 ............................................. pair 1017 Knee Pads 9 20512Black Hawk Elbow pads................................................................................................ pair Elbow Pads 8 1019 30321 Grand Prix Bicycle Road bicycle828 1291 1669 30326 Himalaya BicycleMountain bicycle833 1296 582 30421 Grand Prix Road bicycle tires927 Bicycle Tires16 30426 Himalaya TiresMountain bicycle tires933 18......................

..................................................................... S_PRODUCT Data (continued) ID ---IMAGE_ID -------40421 1381 NAME SHORT_DESC LONGTEXT_ID --------------------------------------SUGGESTED_WHLSL_PRICEWHLSL_UNITS -------------------------------Alexeyer ProStraight bar 928 Lifting Bar 65 40422 1382 Pro Curling BarCurling bar 50 41010 Prostar 10 Ten pound weight 517 Pound Weight 8 41020 Prostar 20 Twenty pound weight527 Pound Weight 12 41050 Prostar 50 Fifty pound weight557 Pound Weight 25 41080 Prostar 80 Eighty pound weight587 Pound Weight 35 41100 Prostar 100 One hundred pound 607 Pound Weightweight 45 50169 1119 Major League Baseball Baseball 4....................................................................................29 929 676 ......................................................................................................Appendix B: Table Descriptions and Data ... B-28 Oracle Forms Developer: Build Internet Applications I ...........................................

...S_PRODUCT Data ................................................ S_PRODUCT Data (continued) ID NAME SHORT_DESC LONGTEXT_ID ---....................................................................................... Oracle Forms Developer: Build Internet Applications I B-29 ..----------------------------------------IMAGE_IDSUGGESTED_WHLSL_PRICEWHLSL_UNITS ---------------------------------------50273Chapman HelmetBatting helmet 780 1223 22......................................................................................................................................89 50417 Griffey GloveOutfielder’s glove 924 1367 80 50418 Alomar GloveInfielder’s glove 1368 75 925 50419 Steinbach GloveCatcher’s glove 1369 80 926 50530Cabrera Bat Thirty inch bat 1480 45 1037 50532 Puckett Bat Thirty-two inch bat 1039 1482 47 50536 Winfield BatThirty-six inch bat 1043 1486 50 Note: This display has been formatted........ .....................

........... B-30 Oracle Forms Developer: Build Internet Applications I ..........................................................................................................................................................................................Appendix B: Table Descriptions and Data ................................. ID --1 2 3 4 5 NAME -------------------------North America South America Africa / Middle East Asia Europe ...................................................................... S_REGION Description and Data Column Name Null? -----------------------------ID NOT NULL NAME NOT NULL Datatype ---------------NUMBER(7) VARCHAR2(50) SQL> SELECT * FROM s_region.

.............................................. Operations VP............... .......................................... TITLE -----------------------President Sales Representative Stock Clerk VP..................................... Finance VP.... S_TITLE Description and Data Column Name Null? Datatype ---------------------------------.. Administration VP..................S_TITLE Description and Data .............. Sales Warehouse Manager 8 rows selected.................................... Oracle Forms Developer: Build Internet Applications I B-31 .................................................---------------TITLE NOT NULL VARCHAR2(25) SQL> SELECT * FROM s_title............................................

............................................... B-32 Oracle Forms Developer: Build Internet Applications I ....................................................2) emp_type_RefCol Name Null? -------------------......................... Oracle8 Objects: Types......................................2) dept_type --------------------------------ID NAME REGION_ID ---------------NUMBER VARCHAR2(25) NUMBER(7) ..... Tables emp_type_ObjCol Name Null? -------------------.Appendix B: Table Descriptions and Data ........................------------ID LAST_NAME FIRST_NAME USERID START_DATE MANAGER_ID TITLE DEPT_ID SALARY COMMISSION_PCT Type ---------------NUMBER(7) VARCHAR2(25) VARCHAR2(25) VARCHAR2(8) DATE NUMBER(7) VARCHAR2(25) DEPT_TYPE NUMBER(11.2) NUMBER(4..........................................................------------ID LAST_NAME FIRST_NAME USERID START_DATE MANAGER_ID TITLE DEPT_ID SALARY COMMISSION_PCT Type ---------------NUMBER(7) VARCHAR2(25) VARCHAR2(25) VARCHAR2(8) DATE NUMBER(7) VARCHAR2(25) REF OF DEPT_TYPE NUMBER(11........................................2) NUMBER(4................

..................................... Tables .............. Oracle Forms Developer: Build Internet Applications I B-33 ...........................---------------------------ID NUMBER(7) LAST_NAME VARCHAR2(25) FIRST_NAME VARCHAR2(25) USERID VARCHAR2(8) START_DATE DATE MANAGER_ID NUMBER(7) TITLE VARCHAR2(25) DEPT_ID DEPT_TYPE SALARY NUMBER(11...Oracle8 Objects: Types....................... 1) 2500 2Ngao 08-MAR-90 DEPT_TYPE(41. ’Administration’.......... 1) 1400 ID LAST_NAME Midorimnagayam 1 VP Sales FIRST_NAME USERID .................2) ID LAST_NAME FIRST_NAME USERID --------.................... 1) 1450 LaDorislngao 1 VP Operations 3Nagayama 17-JUN-91 DEPT_TYPE(31.... NAME...... Tables oo_emp_Table_ObjCol Name Null? Type -------------------....... ’Sales’..-------------1Velasquez Carmencvelasqu 03-MAR-90 President DEPT_TYPE(50...2) COMMISSION_PCT NUMBER(4.. ’Operations’.......................................................---------........----------------------------------...............-------START_DAT MANAGER_ID TITLE --------............. REGION_ID) ----------------------------------------------------------SALARY COMMISSION_PCT ---------..................------------------------DEPT_ID(ID................................

................... ’Operations’....................... ’Operations’..-------- . 4) 1300 ID LAST_NAME FIRST_NAME USERID ---------......... 1) 1450 5 Ropeburn Audry aropebur 04-MAR-90 1 VP Administration DEPT_TYPE(50...............-------------4 Quick-To-See Mark mquickto 07-APR-90 1 VP Finance DEPT_TYPE(10......... ’Operations’.............. 1) 1550 6 Urguhart Molly murguhar 18-JAN-91 2 Warehouse Manager DEPT_TYPE(41.........................................Appendix B: Table Descriptions and Data ............ 3) 1100 9 Catchpole Antoinette acatchpo 09-FEB-92 2 Warehouse Manager DEPT_TYPE(44.. -------------------------------------......................................... 2) 1250 8 Biri Ben bbiri 07-APR-90 2 Warehouse Manager DEPT_TYPE(43.................................................. ’Finance’............... NAME.---------------------------------DEPT_ID(ID...........-----------------------------............-------START_DAT MANAGER_ID TITLE --------......... ’Operations’... ’Administration’.... B-34 Oracle Forms Developer: Build Internet Applications I ........... REGION_ID) -----------------------------------------------------------SALARY COMMISSION_PCT ---------......... 1) 1200 7 Menchu Roberta rmenchu 14-MAY-90 2 Warehouse Manager DEPT_TYPE(42......

. 2) 1490 13 13 Sedeghi Yasmin ysedeghi 18-FEB-91 3 Sales Representative DEPT_TYPE(33...........................Oracle8 Objects: Types.............. 1) 1400 10 12 Giljum Henry hgiljum 18-JAN-92 3 Sales Representative DEPT_TYPE(32..........--------------.................... ’Sales’.................. 5) 145018 ID LAST_NAME FIRST_NAME USERID ----------------------........................ ’Operations’......... 5) 1307 11 Magee Colin cmagee 14-MAY-90 3 Sales Representative DEPT_TYPE(31...------------------------DEPT_ID(ID.............. NAME................................... 4) 1525 15 15 Dumas Andre adumas 09-OCT-91 3 Sales Representative DEPT_TYPE(35..................-------START_DAT MANAGER_ID TITLE . Oracle Forms Developer: Build Internet Applications I B-35 . Tables . ’Sales’.................... ’Sales’.........---------.............................. ’Sales’.............-------------10 Havel Marta mhavel 27-FEB-91 2 Warehouse Manager DEPT_TYPE(45.............. 3) 1515 10 14 Nguyen Mai mnguyen 22-JAN-92 3 Sales Representative DEPT_TYPE(34.... ’Sales’.......................... REGION_ID) -----------------------------------------------------------SALARY COMMISSION_PCT ---------.. START_DAT MANAGER_ID TITLE --------......

.......... REGION_ID) -----------------------------------------------------------SALARY COMMISSION_PCT ---------........................Appendix B: Table Descriptions and Data .................-------START_DAT MANAGER_ID TITLE --------....................................... ’Operations’....................................... ’Operations’.... 2) 1200 anozaki 19 Patel Vikram 06-AUG-91 7 Stock Clerk DEPT_TYPE(42...... ’Operations’.............------------------------DEPT_ID(ID.... ’Operations’........---------. B-36 Oracle Forms Developer: Build Internet Applications I ...... 3) 850 ID LAST_NAME FIRST_NAME USERID ---------.. --------.. 1) 940 gsmith 18 Nozaki Akira 09-FEB-91 7 Stock Clerk DEPT_TYPE(42....-----------------------------. 3) 750 cnewman 21 Markarian Alexander amarkari 26-MAY-91 8 Stock Clerk DEPT_TYPE(43.---------------------------------- ....................... ’Operations’..... 2) 795 vpatel 20 Newman Chad 21-JUL-91 8 Stock Clerk DEPT_TYPE(43........................................... NAME.. 1) 1400 17 Smith George 08-MAR-90 6 Stock Clerk DEPT_TYPE(41......................... ’Operations’.......................................-------------16 Maduro Elena emaduro 07-FEB-92 6 Stock Clerk DEPT_TYPE(41..

............2) ............................................ NAME.............. ’Operations’............ ’Operations’......... ’Operations’......... 5) 860 bdancs 25 Schwartz Sylvie 09-MAY-91 10 Stock Clerk DEPT_TYPE(45....................Oracle8 Objects: Types.......-------------22 Chang Eddie echang 30-NOV-90 9 Stock Clerk DEPT_TYPE(44..................................2) Type ---------------NUMBER(7) VARCHAR2(25) VARCHAR2(25) VARCHAR2(8) DATE NUMBER(7) VARCHAR2(25) REF OF DEPT_TYPE NUMBER(11.............................. DEPT_ID(ID.... 4) 795 rpatel 24 Dancs Bela 17-MAR-91 10 Stock Clerk DEPT_TYPE(45......... ’Sales’...................... 4) 800 23 Patel Radha 17-OCT-90 9 Stock Clerk DEPT_TYPE(34................... 5) 1100 sschwart oo_emp_Table_RefCol Name Null? -----------------------------ID LAST_NAME FIRST_NAME USERID START_DATE MANAGER_ID TITLE DEPT_ID SALARY COMMISSION_PCTNUMBER(4............................. REGION_ID) -----------------------------------------------------------SALARY COMMISSION_PCT ---------..... Tables ................... Oracle Forms Developer: Build Internet Applications I B-37 ................

...................---------.....--------------------------------.......................-------------1 Velasquez Carmen cvelasqu 03-MAR-90 President 0000220208447F54A9ED64676AE03408002072C15B447F54A9ED55676AE03408 002072C15B 2500 2 Ngao LaDoris lngao 08-MAR-90 1 VP Operations 0000220208447F54A9ED5F676AE03408002072C15B447F54A9ED55676AE03408 002072C15B 1450 3 Nagayama Midori mnagayam 17-JUN-91 1 VP Sales 0000220208447F54A9ED5A676AE03408002072C15B447F54A9ED55676AE03408 002072C15B 1400 4 Quick-To-See Mark mquickto 07-APR-90 1 VP Finance 0000220208447F54A9ED59676AE03408002072C15B447F54A9ED55676AE03408 002072C15B 1450 5 Ropeburn Audry aropebur 04-MAR-90 1 VP Administration 0000220208447F54A9ED64676AE03408002072C15B447F54A9ED55676AE03408 002072C15B 1550 .............................................................-------START_DAT MANAGER_ID TITLE --------.................. NAME....... REGION_ID) -----------------------------------------------------------SALARY COMMISSION_PCT ---------.------------------------DEPT_ID(ID..................................................................................... ID LAST_NAME FIRST_NAME USERID ---------............. B-38 Oracle Forms Developer: Build Internet Applications I ..........................................................................Appendix B: Table Descriptions and Data .

............. Oracle Forms Developer: Build Internet Applications I B-39 .......................................------------------------DEPT_ID(ID...-------START_DAT MANAGER_ID TITLE --------...................................-----------------...........................................................................Oracle8 Objects: Types........---------.... ID LAST_NAME FIRST_NAME USERID ---------...............-------------6 Urguhart Molly murguhar 18-JAN-91 2 Warehouse Manager 0000220208447F54A9ED5F676AE03408002072C15B447F54A9ED55676AE03408 002072C15B 1200 9 Catchpole Antoinette acatchpo 09-FEB-92 2 Warehouse Manager 0000220208447F54A9ED62676AE03408002072C15B447F54A9ED55676AE03408 002072C15B 1300 10 Havel Marta mhavel 27-FEB-91 2 Warehouse Manager 0000220208447F54A9ED63676AE03408002072C15B447F54A9ED55676AE03408 002072C15B 1307 11 Magee Colin cmagee 14-MAY-90 3 Sales Representative 0000220208447F54A9ED5A676AE03408002072C15B447F54A9ED55676AE03408 002072C15B 1400 10 13 Sedeghi Yasmin ysedeghi 18-FEB-91 3 Sales Representative 0000220208447F54A9ED5C676AE03408002072C15B447F54A9ED55676AE03408 002072C15B 1515 10 ..........................--------------.................. NAME................................................................. Tables ..... REGION_ID) -----------------------------------------------------------SALARY COMMISSION_PCT ---------...

......................................................--------------....-----------------...................................... REGION_ID) -----------------------------------------------------------SALARY COMMISSION_PCT ---------........-------------14 Nguyen Mai mnguyen 22-JAN-92 3 Sales Representative 0000220208447F54A9ED5D676AE03408002072C15B447F54A9ED55676AE03408 002072C15B 1525 15 15 Dumas Andre adumas 09-OCT-91 3 Sales Representative 0000220208447F54A9ED5E676AE03408002072C15B447F54A9ED55676AE03408 002072C15B 1450 18 16 Maduro Elena emaduro 07-FEB-92 6 Stock Clerk 0000220208447F54A9ED5F676AE03408002072C15B447F54A9ED55676AE03408 002072C15B 1400 17 Smith George gsmith 08-MAR-90 6 Stock Clerk 0000220208447F54A9ED5F676AE03408002072C15B447F54A9ED55676AE03408 002072C15B 940 18 Nozaki Akira anozaki 09-FEB-91 7 Stock Clerk 0000220208447F54A9ED60676AE03408002072C15B447F54A9ED55676AE03408 002072C15B 1200 ..........................................------------------------DEPT_ID(ID.......... ID LAST_NAME FIRST_NAME USERID ---------.....................-------START_DAT MANAGER_ID TITLE --------......................... B-40 Oracle Forms Developer: Build Internet Applications I ....Appendix B: Table Descriptions and Data ..........---------........................................................................................ NAME....

.................. Tables ............... NAME....................---------..........--------------------------------....-------START_DAT MANAGER_ID TITLE --------......................................................------------------------DEPT_ID(ID...................Oracle8 Objects: Types....................................................................................... ID LAST_NAME FIRST_NAME USERID ---------.......................... Oracle Forms Developer: Build Internet Applications I B-41 .............................-------------19 Patel Vikram vpatel 06-AUG-91 7 Stock Clerk 0000220208447F54A9ED60676AE03408002072C15B447F54A9ED55676AE03408 002072C15B 795 20 Newman Chad cnewman 21-JUL-91 8 Stock Clerk 0000220208447F54A9ED61676AE03408002072C15B447F54A9ED55676AE03408 002072C15B 750 21 Markarian Alexander amarkari 26-MAY-91 8 Stock Clerk 0000220208447F54A9ED61676AE03408002072C15B447F54A9ED55676AE03408 002072C15B 850 22 Chang Eddie echang 30-NOV-90 9 Stock Clerk 0000220208447F54A9ED62676AE03408002072C15B447F54A9ED55676AE03408 002072C15B 800 23 Patel Radha rpatel 17-OCT-90 9 Stock Clerk 0000220208447F54A9ED5D676AE03408002072C15B447F54A9ED55676AE03408 002072C15B 795 ..................... REGION_ID) -----------------------------------------------------------SALARY COMMISSION_PCT ---------.....

...................................................................... NAME...................................................................................---------. ID LAST_NAME FIRST_NAME USERID ---------........Appendix B: Table Descriptions and Data .............------------------------DEPT_ID(ID........................................................... B-42 Oracle Forms Developer: Build Internet Applications I .......................... REGION_ID) -----------------------------------------------------------SALARY COMMISSION_PCT ---------....................................--------------------------------...-------------24 Dancs Bela bdancs 17-MAR-91 10 Stock Clerk 0000220208447F54A9ED63676AE03408002072C15B447F54A9ED55676AE03408 002072C15B 860 25 Schwartz Sylvie sschwart 09-MAY-91 10 Stock Clerk 0000220208447F54A9ED63676AE03408002072C15B447F54A9ED55676AE03408 002072C15B 1100 oo_dept_table Name -------------------ID NAME REGION_ID Null? ------------- Type ---------------NUMBER VARCHAR2(25) NUMBER(7) ID NAME REGION_ID ----------------------------------------------10 Finance 1 31 Sales 1 32 Sales 2 33 Sales 3 34 Sales 4 35 Sales 5 41 Operations 1 42 Operations 2 43 Operations 3 44 Operations 4 45 Operations 5 50 Administration 1 ....-------START_DAT MANAGER_ID TITLE --------....

.............................---------.....................................................................2) ID LAST_NAME FIRST_NAME USERID ---------........................ 1) 1450 lngao 3 Nagayama Midori 17-JUN-91 1 VP Sales DEPT_TYPE(31.......... REGION_ID) -----------------------------------------------------------SALARY COMMISSION_PCT ---------..2) NUMBER(4.......... 1) 2500 2 Ngao LaDoris 08-MAR-90 1 VP Operations DEPT_TYPE(41......................-------START_DAT MANAGER_ID TITLE --------....... 1) 1400 mnagayam ............. ’Operations’......... Oracle Forms Developer: Build Internet Applications I B-43 ............. ’Sales’........... ’Administration’..... rel_emp_Table_Objcol Name -------------------ID LAST_NAME FIRST_NAME USERID START_DATE MANAGER_ID TITLE DEPT_ID SALARY COMMISSION_PCT Null? ------------- Type ---------------NUMBER(7) VARCHAR2(25) VARCHAR2(25) VARCHAR2(8) DATE NUMBER(7) VARCHAR2(25) DEPT_TYPE NUMBER(11...--------------------------------..............------------------------DEPT_ID(ID............ NAME.................................... Tables .........-------------1 Velasquez Carmen cvelasqu 03-MAR-90 President DEPT_TYPE(50...........Oracle8 Objects: Types.......

............ 1) 1200 7 Menchu Roberta rmenchu 14-MAY-90 2 Warehouse Manager DEPT_TYPE(42.....---------............... REGION_ID) -----------------------------------------------------------SALARY COMMISSION_PCT ---------.......................... ’Operations’.............................--------------------------------..... 4) 1300 ........ ’Operations’.................. 3) 1100 9 Catchpole Antoinette acatchpo 09-FEB-92 2 Warehouse Manager DEPT_TYPE(44........... B-44 Oracle Forms Developer: Build Internet Applications I .......-------------4 Quick-To-See Mark mquickto 07-APR-90 1 VP Finance DEPT_TYPE(10.......... 1) 1450 5 Ropeburn Audry aropebur 04-MAR-90 1 VP Administration DEPT_TYPE(50........... NAME................................................. 1) 1550 6 Urguhart Molly murguhar 18-JAN-91 2 Warehouse Manager DEPT_TYPE(41............................. ’Operations’...------------------------DEPT_ID(ID........... 2) 1250 8 Biri Ben bbiri 07-APR-90 2 Warehouse Manager DEPT_TYPE(43................... ’Operations’.................Appendix B: Table Descriptions and Data ...... ’Administration’.-------START_DAT MANAGER_ID TITLE --------................... ID LAST_NAME FIRST_NAME USERID ---------.. ’Finance’......

.. ’Sales’.. 5) 1450 18 ............ ’Sales’........------------------------DEPT_ID(ID........................ ’Sales’... 2) 1490 13 13 Sedeghi Yasmin ysedeghi 18-FEB-91 3 Sales Representative DEPT_TYPE(33........... 3) 1515 10 14 Nguyen Mai mnguyen 22-JAN-92 3 Sales Representative DEPT_TYPE(34............ REGION_ID) -----------------------------------------------------------SALARY COMMISSION_PCT ---------......--------------------------------........................................................ Tables ............................................ Oracle Forms Developer: Build Internet Applications I B-45 ........Oracle8 Objects: Types......................... ’Operations’.---------......................................... ID LAST_NAME FIRST_NAME USERID ---------............... ’Sales’.....-------START_DAT MANAGER_ID TITLE --------...........-------------10 Havel Marta mhavel 27-FEB-91 2 Warehouse Manager DEPT_TYPE(45. 5) 1307 11 Magee Colin cmagee 14-MAY-90 3 Sales Representative DEPT_TYPE(31................ 1) 1400 10 12 Giljum Henry hgiljum 18-JAN-92 3 Sales Representative DEPT_TYPE(32... ’Sales’........ 4) 1525 15 15 Dumas Andre adumas 09-OCT-91 3 Sales Representative DEPT_TYPE(35..... NAME.

................................................ ’Operations’....... ’Operations’.................. ’Operations’.................. ’Operations’..... REGION_ID) -----------------------------------------------------------SALARY COMMISSION_PCT ---------..................-------START_DAT MANAGER_ID TITLE --------.............---------....... 1) 940 gsmith 18 Nozaki Akira 09-FEB-91 7 Stock Clerk DEPT_TYPE(42... B-46 Oracle Forms Developer: Build Internet Applications I ..................... 2) 795 vpatel 20 Newman Chad 21-JUL-91 8 Stock Clerk DEPT_TYPE(43..Appendix B: Table Descriptions and Data ..................--------------------------------... 2) 1200 anozaki 19 Patel Vikram 06-AUG-91 7 Stock Clerk DEPT_TYPE(42...................... ’Operations’...... 3) 850 amarkari .................. NAME................ ID LAST_NAME FIRST_NAME USERID ---------.............................. ’Operations’.............. 1) 1400 17 Smith George 08-MAR-90 6 Stock Clerk DEPT_TYPE(41. 3) 750 cnewman 21 Markarian Alexander 26-MAY-91 8 Stock Clerk DEPT_TYPE(43.............------------------------DEPT_ID(ID.......-------------16 Maduro Elena emaduro 07-FEB-92 6 Stock Clerk DEPT_TYPE(41...........

.................. Oracle Forms Developer: Build Internet Applications I B-47 ............................................... ID LAST_NAME FIRST_NAME USERID ---------.................................. ’Operations’. 4) 800 23 Patel Radha 17-OCT-90 9 Stock Clerk DEPT_TYPE(34.................... 4) 795 rpatel 24 Dancs Bela 17-MAR-91 10 Stock Clerk DEPT_TYPE(45....Oracle8 Objects: Types...... Tables ..........---------.............................................. ’Operations’................... NAME..... ’Sales’..------------------------DEPT_ID(ID................ 5) 860 bdancs 25 Schwartz Sylvie 09-MAY-91 10 Stock Clerk DEPT_TYPE(45..............--------------------------------.. REGION_ID) -----------------------------------------------------------SALARY COMMISSION_PCT ---------....... ’Operations’................-------------22 Chang Eddie echang 30-NOV-90 9 Stock Clerk DEPT_TYPE(44......................-------START_DAT MANAGER_ID TITLE --------....... 5) 1100 sschwart ....................

................................2) NUMBER(4.............................Appendix B: Table Descriptions and Data ....... B-48 Oracle Forms Developer: Build Internet Applications I ................. rel_emp_Table_RefCol Name -------------------ID LAST_NAME FIRST_NAME USERID START_DATE MANAGER_ID TITLE DEPT_ID SALARY COMMISSION_PCT Null? ------------- Type ---------------NUMBER(7) VARCHAR2(25) VARCHAR2(25) VARCHAR2(8) DATE NUMBER(7) VARCHAR2(25) REF OF DEPT_TYPE NUMBER(11........................................................................................................................................2) .................................................................................

................. ID LAST_NAME FIRST_NAME USERID ---------...........-------------1 Velasquez Carmen cvelasqu 03-MAR-90 President 0000220208447F54A9ED64676AE03408002072C15B447F54A9ED55676AE03408 002072C15B 2500 2 Ngao LaDoris lngao 08-MAR-90 1 VP Operations 0000220208447F54A9ED5F676AE03408002072C15B447F54A9ED55676AE03408 002072C15B 1450 3 Nagayama Midori mnagayam 17-JUN-91 1 VP Sales 0000220208447F54A9ED5A676AE03408002072C15B447F54A9ED55676AE03408 002072C15B 1400 4 Quick-To-See Mark mquickto 07-APR-90 1 VP Finance 0000220208447F54A9ED59676AE03408002072C15B447F54A9ED55676AE03408 002072C15B 1450 5 Ropeburn Audry aropebur 04-MAR-90 1 VP Administration 0000220208447F54A9ED64676AE03408002072C15B447F54A9ED55676AE03408 002072C15B 1550 ..........................Oracle8 Objects: Types............................ NAME..................................................................................................................................................---------.......--------------------------------.................... REGION_ID) -----------------------------------------------------------SALARY COMMISSION_PCT ---------... Oracle Forms Developer: Build Internet Applications I B-49 .........------------------------DEPT_ID(ID..........................-------START_DAT MANAGER_ID TITLE --------..... Tables ..........

...................................... ID LAST_NAME FIRST_NAME USERID ---------........... NAME..................................Appendix B: Table Descriptions and Data .............................................................-------------6 Urguhart Molly murguhar 18-JAN-91 2 Warehouse Manager 0000220208447F54A9ED5F676AE03408002072C15B447F54A9ED55676AE03408 002072C15B 1200 9 Catchpole Antoinette acatchpo 09-FEB-92 2 Warehouse Manager 0000220208447F54A9ED62676AE03408002072C15B447F54A9ED55676AE03408 002072C15B 1300 10 Havel Marta mhavel 27-FEB-91 2 Warehouse Manager 0000220208447F54A9ED63676AE03408002072C15B447F54A9ED55676AE03408 002072C15B 1307 11 Magee Colin cmagee 14-MAY-90 3 Sales Representative 0000220208447F54A9ED5A676AE03408002072C15B447F54A9ED55676AE03408 002072C15B 1400 10 13 Sedeghi Yasmin ysedeghi 18-FEB-91 3 Sales Representative 0000220208447F54A9ED5C676AE03408002072C15B447F54A9ED55676AE03408 002072C15B 1515 10 .--------------------------------........-------START_DAT MANAGER_ID TITLE --------.............................---------.................................------------------------DEPT_ID(ID............................. REGION_ID) -----------------------------------------------------------SALARY COMMISSION_PCT ---------.................. B-50 Oracle Forms Developer: Build Internet Applications I .............................................

....---------......................................................................------------------------DEPT_ID(ID.....................-------START_DAT MANAGER_ID TITLE --------............... NAME.--------------------------------..................................Oracle8 Objects: Types......................... Oracle Forms Developer: Build Internet Applications I B-51 ................................ ID LAST_NAME FIRST_NAME USERID ---------.......................................................................-------------14 Nguyen Mai mnguyen 22-JAN-92 3 Sales Representative 0000220208447F54A9ED5D676AE03408002072C15B447F54A9ED55676AE03408 002072C15B 1525 15 15 Dumas Andre adumas 09-OCT-91 3 Sales Representative 0000220208447F54A9ED5E676AE03408002072C15B447F54A9ED55676AE03408 002072C15B 1450 18 16 Maduro Elena emaduro 07-FEB-92 6 Stock Clerk 0000220208447F54A9ED5F676AE03408002072C15B447F54A9ED55676AE03408 002072C15B 1400 17 Smith George gsmith 08-MAR-90 6 Stock Clerk 0000220208447F54A9ED5F676AE03408002072C15B447F54A9ED55676AE03408 002072C15B 940 18 Nozaki Akira anozaki 09-FEB-91 7 Stock Clerk 0000220208447F54A9ED60676AE03408002072C15B447F54A9ED55676AE03408 002072C15B 1200 ..... REGION_ID) -----------------------------------------------------------SALARY COMMISSION_PCT ---------....... Tables .......................

.................... ID LAST_NAME FIRST_NAME USERID ---------................................-------------19 Patel Vikram vpatel 06-AUG-91 7 Stock Clerk 0000220208447F54A9ED60676AE03408002072C15B447F54A9ED55676AE03408 002072C15B 795 20 Newman Chad cnewman 21-JUL-91 8 Stock Clerk 0000220208447F54A9ED61676AE03408002072C15B447F54A9ED55676AE03408 002072C15B 750 21 Markarian Alexander amarkari 26-MAY-91 8 Stock Clerk 0000220208447F54A9ED61676AE03408002072C15B447F54A9ED55676AE03408 002072C15B 850 22 Chang Eddie echang 30-NOV-90 9 Stock Clerk 0000220208447F54A9ED62676AE03408002072C15B447F54A9ED55676AE03408 002072C15B 800 23 Patel Radha rpatel 17-OCT-90 9 Stock Clerk 0000220208447F54A9ED5D676AE03408002072C15B447F54A9ED55676AE03408 002072C15B 795 ............................................Appendix B: Table Descriptions and Data ....................................---------.............................. NAME....................................... B-52 Oracle Forms Developer: Build Internet Applications I ........--------------------------------... REGION_ID) -----------------------------------------------------------SALARY COMMISSION_PCT ---------...........................------------------------DEPT_ID(ID..............................................-------START_DAT MANAGER_ID TITLE --------......................

.............. NAME......................................................-------------24 Dancs Bela bdancs 17-MAR-91 10 Stock Clerk 0000220208447F54A9ED63676AE03408002072C15B447F54A9ED55676AE03408 002072C15B 860 25 Schwartz Sylvie sschwart 09-MAY-91 10 Stock Clerk 0000220208447F54A9ED63676AE03408002072C15B447F54A9ED55676AE03408 002072C15B 1100 ......... ID LAST_NAME FIRST_NAME USERID ---------........---------.....................................................Oracle8 Objects: Types........................................................ Tables ..-------START_DAT MANAGER_ID TITLE --------.. Oracle Forms Developer: Build Internet Applications I B-53 ......------------------------DEPT_ID(ID............................................................. REGION_ID) -----------------------------------------------------------SALARY COMMISSION_PCT ---------..........................--------------------------------.................

.......... .....................................................................................................................Appendix B: Table Descriptions and Data .................... B-54 Oracle Forms Developer: Build Internet Applications I .........................................................................................................................................................

.........C ...................... Oracle Rdb Overview ..

........ The Oracle Rdb server includes management utilities that are accessed using a command-line interface.............................. mission-critical applications........ Supported Platforms Oracle Rdb is available on the following computing platforms: • OpenVMS VAX • OpenVMS Alpha • Windows NT Intel Oracle Rdb Features These are some of the features that Oracle Rdb offers: • High performance Rdb is optimized to meet enterprise OLTP requirements for the highest levels of performance on OpenVMS Alpha and VAX... Oracle continues to enhance the functionality of Rdb by adding new features and strengthening integration with other Oracle technology and tools........................................ high performance.... C-2 Oracle Forms Developer: Build Internet Applications I ........ The TRACE/Expert Option provides performance monitoring and expert database design for Rdb............... It is used in many large online transaction processing (OLTP) systems........................... It includes a full set of utilities for database maintenance and an industrystandard version of SQL that allows you to easily create applications and maintain your Oracle Rdb databases..Appendix C: Oracle Rdb Overview ............. and the Enterprise Manager DBAPack for Rdb provides a complete set of management tools for Rdb that can be run from the Oracle Enterprise Manager console......................... Default database settings provide great performance for Rdb out of the box. • Ease of management Rdb provides comprehensive..... Rdb8 integration with Oracle Enterprise Manager provides common graphical interfaces to manage Rdb and Oracle RDBMS from the same Windows console...... and ease of use in large-scale........... Oracle Rdb is currently running on more than 45........................... pinning tables in memory for rapid access. Features include full support for 64bit very large memory on OpenVMS Alpha. ........ and query outlines for repeatable query performance...............000 servers at more than 15.000 sites worldwide......... simple management of Rdb databases........... and its customer list includes some of the world’s leading corporations....... patented record caching.... mixed clusters..................... a patented dynamic query optimizer........... What Is Oracle Rdb? Oracle Rdb is a multiuser relational database management system designed and developed by Oracle Corporation for high availability....

............. Oracle Rdb Features (continued) • Integration with other Oracle technologies Rdb customers can leverage their investment in Rdb by enhancing existing applications and developing new ones with the latest Oracle tools for Web and client-server application development and powerful business intelligence analysis........... • Disaster tolerance The Hot Standby Option is ideal where very high performance and continuous (24x7x365) availability is essential...... Oracle Forms Developer. complete implementation of Rdb that is suitable for development and personal use................. Customers and application partners can use standard Oracle APIs to build applications that run on Rdb and Oracle RDBMS.... ... licensed at no charge and available to users through the Oracle Technology Network..... and Oracle Express Server...... Oracle Discoverer....... Oracle network protocols............... Rdb includes support for the Oracle Call Level Interface (OCI)............ It provides disaster tolerance across geographically dispersed systems using the existing network with no change in applications or increment in system overhead.............. multithreaded................. Rdb supports Oracle Application Server............... The Hot Standby system can be accessed simultaneously for read-only transactions...... Oracle Designer......................... Rdb Workbench for Windows NT/Intel is a native... • Support for SQL*Net for Rdb This enables integration with the Oracle technologies listed above..... Oracle Forms Developer: Build Internet Applications I C-3 ........................................................... The Workbench is an unsupported developer’s kit......... Customers can make a single investment in products and training that is completely portable across Rdb and Oracle RDBMS.. and DB Links.............. but it is not recommended for deployment of production systems................ Data sharing between Rdb and Oracle RDBMS is enabled without the use of gateways... • Rdb Workbench for Windows NT/Intel Customers using Oracle Rdb can extend their environment to run Rdb on Windows NT systems........What Is Oracle Rdb? ....... Oracle Reports Developer......................

.......... and company.......................................oracle...................... Look here for information such as: • New product releases • Product interoperability information • How customers are using Oracle Rdb • Calendar of product-related events Oracle Rdb Demonstration CD-ROM TTo receive a free Oracle Rdb product demonstration CD-ROM.. go to the Oracle corporate Web site: http://www................................................... address. C-4 Oracle Forms Developer: Build Internet Applications I ...... including your name.................... Oracle Rdb Product Information TThe Oracle Rdb Web site: http://www.............. to: infordb@us.....................Appendix C: Oracle Rdb Overview ........ and enrollment information............... send e-mail...... schedules.... ....com or call 1-800-633-0575...... Other Information Oracle Rdb Education Oracle University offers a comprehensive series of Oracle Rdb courses...........oracle..........................oracle.com/rdb is the resource for finding out the latest news on the product and its features..................................... The course titles include: • Introduction to Rdb: Technical Overview and SQL Language • Rdb for the Database Administrator • Rdb for the Database Designer • Rdb 3GL Programming • Rdb Performance and Tuning • Rdb Internals To view course descriptions..............com Specify that you would like to receive the free Oracle Rdb CD-ROM.

............D .......... Locking in Form Builder ...........

................. you should be able to do the following: • • Identify the locking mechanisms in Form Builder • Plan trigger code to minimize overheads on locking Write triggers to invoke or intercept the locking process Copyright  Oracle Corporation..Appendix D: Locking in Form Builder ..................................................................................................................................................... 2000..... ........................................ D-2 Oracle Forms Developer: Build Internet Applications I .......... Objectives After completing this lesson...................................................................... All rights reserved............

............ Instructor Note Topic Lecture Timing 17 minutes Total 17 minutes ........................................................................ This lesson shows you how Forms handles locking and how you can design forms with these mechanisms in mind.............. Overview Locking is an important consideration in multiuser applications that access the database............................................................................................................................................................................... Oracle Forms Developer: Build Internet Applications I D-3 ..............................

................................................. 2000.. update................ D-4 Oracle Forms Developer: Build Internet Applications I .... or delete Row in (X) Query Table in (RX) Copyright  Oracle Corporation...... or delete Row in (X) Insert............................... All rights reserved.. .. Locking Insert..........................................Appendix D: Locking in Form Builder .... update......................................................................................................................................................

......... Locking In database applications...................... usually occurs because of a DML operation .... Here is a reminder of the main points: • Oracle8 uses row-level locking to protect data that is being inserted.................Locking .......... A session issues locks to prevent other sessions from performing certain actions on a row or table.. • Queries do not prevent other database sessions from performing data manipulation....................... • Locks are released at the end of a database transaction (following a rollback or commit).. The main Oracle8 locks that affect Form Builder applications are the following: Lock Type Exclusive (X) row lock Row Share (RS) table lock Row Exclusive (RX) table lock Description Only allows other sessions to read the affected rows Prevents the above lock (X) from being applied to the entire table................... usually occurs because of SELECT .. locking maintains the consistency and integrity of the data........................... FOR UPDATE Allows write operations on a table from several sessions simultaneously........... This also applies to the reverse situation...... updated......... Form Builder applications are involved in this locking process when they access database information.............................. Oracle8 Locking Form Builder applications that connect to an Oracle8 database are subject to the standard locking mechanisms employed by the server...... Oracle Forms Developer: Build Internet Applications I D-5 ....... . but prevents (X) lock on entire table...... ................................... or deleted................................ where several users are potentially accessing the same tables and rows.......................................

Copyright  Oracle Corporation......................... D-6 Oracle Forms Developer: Build Internet Applications I .............. All rights reserved......... .. All rights reserved.......................................... normal locking protection applies.................................... 2000..............................................Appendix D: Locking in Form Builder ........................... • Form Builder tells the operator if another user has already locked the record.................................................. Concurrent Updates and Deletes • When users compete for the same record............. Default Locking in Form Builder Insert record No locks Update record RS on table Delete record RS on table Action Save RX on above Copyright  Oracle Corporation............ 2000..................................

...................... or deletes records in a base table block... The user must requery before the user’s own change can be applied............ • Another user has committed changes since a record was queried................... The user has the option of waiting or trying again later.................... when the operator performs actions: Operator Action Insert a record Update database items in a record* Delete record in base table block Save Locks No locks Row Share (RS) on base table Exclusive (X) on corresponding row Row Share (RS) on base table Exclusive (X) on corresponding row Row Exclusive (RX) on base tables during the posting process (Locks are released when actions are completed successfully........ What Happens When Users Compete for the Same Row? Users who are only querying data are not affected here................ then integrity is protected by the locking that occurs automatically at row level.......... These locks are released when a save is complete........ Default Locking in Forms Form Builder initiates locking automatically when the operator inserts...... Oracle Forms Developer: Build Internet Applications I D-7 ............................................ so that other users cannot perform conflicting actions on these rows until the locking form has completed (Saved) its transaction........Default Locking in Forms .................... Form Builder causes the following locks on Oracle base tables and rows................................. Form Builder also keeps each user informed of these events through messages and alerts when: • A row is already locked by another user........... . If two users are attempting to update or delete the same record...... updates..................) *Update of nondatabase items with the Lock Record property set to Yes also causes this....................................... The exclusive locks are applied to reserve rows that correspond to records that the operator is deleting or updating.............

... 2000.......Appendix D: Locking in Form Builder .......... D-8 Oracle Forms Developer: Build Internet Applications I ................ 2000.................................. ........ User A: Step 1 Copyright  Oracle Corporation........................... All rights reserved....................................... User B: Step 2 Copyright  Oracle Corporation...................................................... All rights reserved.............................................................................................................

......... This user can request additional attempts or reply No and try later.......... Employee Dumas still appears in department 15 in this form............ User B attempts to update the record by changing the sales representative’s name to Agasi. Example: Two Users Accessing the Same Record 1 User A is running the Personnel application and queries the sales representatives......... User B replies No................... Forms issues an alert saying the attempt to reserve the record failed.......... Since this action requests a lock on the row... Apply the actions as given in steps 1–4..... (This results in the fatal error message 40501.................... and this row is already locked by User A.. is updated so that his department is changed to 31................. which confirms that the original update action has failed........ User A does not save the change at this point in time......Default Locking in Forms ................ The situation is shown in the lower slide....................) Instructor Note Show a similar example......... Dumas.. Oracle Forms Developer: Build Internet Applications I D-9 ............... opposite.... by starting two separate Forms run-time sessions........... .................... 2 User B is running the Summit application and has started a form that accesses the sales representatives............. because User A has not yet saved the change to the database........... opposite... The row that corresponds to the changed record is now locked (exclusively)................................. The record for employee 15............... The current situation is shown in the top slide......................

....................................................... User B: Step 4 Copyright  Oracle Corporation.. All rights reserved....................... 2000................................. ..................................................... D-10 Oracle Forms Developer: Build Internet Applications I . All rights reserved...................Appendix D: Locking in Form Builder ... User A: Step 3 Copyright  Oracle Corporation................................................................. 2000.....................................................

......... User A now saves the change to Dumas’ department............ Oracle Forms Developer: Build Internet Applications I D-11 ........ However..... This situation is shown in the lower slide.. Once User B requeries.. ..........................Default Locking in Forms ............................ 4 In the Sales Representatives form....................... the record can then be changed.......... because the database row itself has now changed since it was queried in this form....... Example: Two Users Accessing the Same Record (continued) 3 Back in the Personnel form.......................................................... Form Builder tells User B that it must be requeried before a change can be made........................................ which applies the change to the database row and then releases the lock at the end of the transaction........ opposite.................... opposite................ User B can now alter the record.............. This is shown in the upper slide...........................

.......................... D-12 Oracle Forms Developer: Build Internet Applications I ........................................................ ............................ Concurrent Updates and Deletes Achieved by: • • • • SQL data manipulation language SQL explicit locking statements Built-in subprograms DML statements Copyright  Oracle Corporation......................................................................................................................................................................... 2000.................. All rights reserved....Appendix D: Locking in Form Builder ...

.. To keep locking duration to a minimum......... ...... These triggers fire during the process of applying and saving the user’s changes.... Locking in Triggers In addition to the default locking described earlier............... DML statements should be used only in transactional triggers..... which add to those that Forms does during the saving process (posting and committing)................... database locks can occur in Forms applications because of actions that you include in triggers........................ These trigger SQL commands cause implicit locks on the tables and rows that they affect. .. just before the end of a transaction when locks are released................... • SQL locking statements: You can explicitly issue locks from a trigger through the SELECT ........... though rarely necessary.................... when all changes have been applied..... so that their actions are completed quickly............................. Oracle Forms Developer: Build Internet Applications I D-13 ..................... Locking by DML Statements If you include DML statements in transactional triggers................. FOR UPDATE statement..... These can be: • SQL data manipulation language (DML): Sometimes you may need to perform INSERT............. The LOCK TABLE statement is also allowed... and DELETE statements................ UPDATE....... their execution causes: • Row exclusive lock on the affected table • Exclusive lock on the affected rows Because locks are not released until the end of the transaction...Locking in Triggers ........ • Built-in subprograms: Certain built-ins allow you to explicitly lock rows that correspond to the current record (LOCK_RECORD) or to records fetched on a query (ENTER_QUERY and EXECUTE_QUERY)............................... ........................... it is advantageous to code DML statements as efficiently as possible..

................ .............................................. 2000........................................................................... Locking with Built-ins • • ENTER_QUERY (FOR_UPDATE) EXECUTE_QUERY (FOR_UPDATE) Copyright  Oracle Corporation..................................................................................................................... All rights reserved....... D-14 Oracle Forms Developer: Build Internet Applications I .............Appendix D: Locking in Form Builder ..............................

.......... where it has the same effect as Form Builder’s default locking.......................... these built-ins exclusively lock the rows fetched for their query..................... Locking with Built-ins Form Builder maintains a hidden item called rowid in each base table block......... Updates or deletes in triggers that apply to such rows can identify them most efficiently using this value............Locking in Triggers ..... Care should be taken when reserving rows in this way......................................................... Oracle Forms Developer: Build Internet Applications I D-15 ................................ This item stores the ROWID value for the corresponding row of each record................ • LOCK_RECORD: This built-in locks the row that corresponds to the current record in the form......... .................... because large queries cause locking on many rows.............................................. as in the example below: UPDATE s_ord SET date_stamp = SYSDATE WHERE ROWID = :order................rowid................... Locking with Built-in Subprograms The following built-ins allow locking: • EXECUTE_QUERY (FOR_UPDATE) and ENTER_QUERY (FOR_UPDATE): When called with the FOR_UPDATE option...... This is typically used in an On-Lock trigger.........

........................ D-16 Oracle Forms Developer: Build Internet Applications I .. All rights reserved........................................ Copyright  Oracle Corporation........................................................................ .................................................... ELSE MESSAGE(’You are not authorized to change records here’)............ RAISE form_trigger_failure.............. On-Lock Trigger Example IF USER = ’MANAGER’ THEN LOCK_RECORD................................ 2000................. END IF.........Appendix D: Locking in Form Builder ..................................

........... Oracle Forms Developer: Build Internet Applications I D-17 ....... END IF................. typically when the user updates or deletes a record in a base table block........) • Handle locking when directly accessing non-Oracle data sources If this trigger succeeds.................................................................................................................Locking in Triggers .... Use this trigger to: • Bypass locking on a single-user system.............. ........ On-Lock Trigger This block-level trigger replaces the default locking that Forms normally carries out........... then the row remains unlocked after the user’s update or delete operation....... END IF.......... IF NOT FORM_SUCCESS THEN RAISE form_trigger_failure....... Example The following On-Lock trigger on the block Stock only permits the user MANAGER to lock records for update or delete... but its action does not lock the record................ ELSE MESSAGE(’You are not authorized to change records here’)...................................... RAISE form_trigger_failure......... Use the LOCK_RECORD built-in within the trigger if locking is not to be bypassed... The trigger fires before the change to the record is displayed... On failure................ the input focus is set on the current item........... IF USER = ’MANAGER’ THEN LOCK_RECORD. hence speeding processing • Conditionally lock the record or fail the trigger (Failing the trigger effectively fails the user’s action..

.... ........................................................................... All rights reserved............................................................................................... D-18 Oracle Forms Developer: Build Internet Applications I ..........................................Appendix D: Locking in Form Builder ................. 2000.......................... Summary • Default locking – Locks rows during update and delete – Informs user of concurrent update and delete • Locking in triggers – Use SQL and certain built-ins – On-Lock trigger: LOCK_RECORD built-in available Copyright  Oracle Corporation.............................................

................................................................................................ Oracle Forms Developer: Build Internet Applications I D-19 ........................................................... Summary Default Locking • Locks rows during update and delete • Informs user about concurrent update and delete Locking in Triggers • Use SQL and certain built-ins • On-Lock trigger: LOCK_RECORD built-in available ................Summary ..................................................................................................................................

....................................................................................................................... D-20 Oracle Forms Developer: Build Internet Applications I .......................................... ...........................................................................................................................Appendix D: Locking in Form Builder .................

............E ......... Oracle8 Object Features ............

.......................................................................................................................................... object columns....Appendix E: Oracle8 Object Features .. you should be able to do the following: • Describe the Oracle8 scalar datatypes • Describe object types and objects • Describe object tables. All rights reserved.................................................................................. ......................... and object views • Describe the INSTEAD-OF triggers • Describe object REFs • Identify the display of objects in the Object Navigator Copyright  Oracle Corporation. 2000.................................... Objectives After completing this lesson............. E-2 Oracle Forms Developer: Build Internet Applications I .....

................................... Oracle Forms Developer: Build Internet Applications I E-3 ......................... Overview Introduction In this lesson.............. This lesson also explains how objects are displayed in the Object Navigator.......................................................................................Overview .............................. you will review certain object features of Oracle8....................... you should be able to do the following: • Describe the Oracle8 scalar datatypes • Describe object types and objects • Describe object tables............. and object views • Describe the INSTEAD-OF triggers • Describe object REFs • Identify the display of objects in the Object Navigator .............................................. object columns............ Objectives After completing this lesson......................

................................................................................................................................................... 2000...... .................. E-4 Oracle Forms Developer: Build Internet Applications I .................... All rights reserved..............................................................Appendix E: Oracle8 Object Features ......................... Oracle8 Scalar Datatypes • NCHAR • NVARCHAR2 • FLOAT • NLS types Copyright  Oracle Corporation..........................

....... There is no change to the way scalar datatypes are displayed in Oracle Forms Developer and Oracle Reports Developer..... • NVARCHAR2 stores variable-length NLS character data....................... ............... With NLS.. The datatypes are automatically converted to existing Forms and Reports item datatypes................... You can only specify a binary precision................................... NLS Types Oracle8 offers extended NLS... Oracle Forms Developer: Build Internet Applications I E-5 ............................... NLS is discussed in Oracle8 Server Reference Manual.... Users around the world can interact with the Oracle server in their native languages.............. number and date formats adapt automatically to the language conventions specified for a user session.........................Oracle8 Datatypes ..................... However....... How the data is represented internally depends on the national character set..................... which store NLS data....... • FLOAT is a subtype of NUMBER...... you cannot specify a scale for FLOAT variables...... How the data is represented internally depends on the national character set..... which is the total number of binary digits.... Oracle8 Datatypes Scalar Datatypes • NCHAR stores fixed-length (blank-padded if necessary) NLS (National Language Support) character data............. which might use a fixed-width encoding such as US7ASCII or a variable-width encoding such as JA16SJIS..... which might use a fixed-width encoding such as WE8EBCDIC37C or a variable-width encoding such as JA16DBCS................................... including national character sets and the datatypes NCHAR and NVARCHAR2........

.............................Appendix E: Oracle8 Object Features ............................................................. ..................................................................... Object Types Attributes Copyright  Oracle Corporation......................................................... 2000.......................... All rights reserved........................... E-6 Oracle Forms Developer: Build Internet Applications I ...................................

.....WNDS........ all methods are defined in the package body...........RNPS............................... As with package variables. loc VARCHAR2(3)...... RNDS.. Like packages.....WNPS).... A method describes the behavior of an object type... MEMBER FUNCTION get_dept_id RETURN NUMBER. attributes declared in the object type specification are public and those declared in the body are private.. END..................... CREATE TYPE BODY dept_type AS MEMBER PROCEDURE set_dept_id (d_id NUMBER) IS BEGIN dept_id := d_id... object types can contain procedures and functions. As with package subprograms...... PRAGMA RESTRICT_REFERENCES (get_dept_id.....WNPS))............... these subprograms are known as methods...................... Object Types (continued) Methods An object type is also similar to a package... Once an object is declared... its attributes are similar to package variables. dnameVARCHAR2(14).. Like packages.............................WNDS.....................RNPS..... RNDS..........Oracle8 Datatypes .. object types can be declared in two parts: a specification and a body........ In object types. Oracle Forms Developer: Build Internet Applications I E-9 ................... END...... MEMBER PROCEDURE set_dept_id (d_id NUMBER)..... END.............................. PRAGMA RESTRICT_REFERENCES (set_dept_id..... MEMBER FUNCTION get_dept_id RETURN NUMBER IS BEGIN RETURN (dept_id)..... Here is an example of an object type: CREATE TYPE dept_type AS OBJECT (dept_idNUMBER(2)........................ but only those whose specification appears in the object type specification are public methods.. ...

............................. 2000............ ............................................... E-8 Oracle Forms Developer: Build Internet Applications I .....................................................................................Appendix E: Oracle8 Object Features . Object Types Attributes Ship ORDER Check status po_no custinfo line_items amount Cancel Hold Methods Copyright  Oracle Corporation......................................................................... All rights reserved.........................................................

.................... Object Types (continued) Methods An object type is also similar to a package............ CREATE TYPE BODY dept_type AS MEMBER PROCEDURE set_dept_id (d_id NUMBER) IS BEGIN dept_id := d_id.........RNPS............ As with package variables.....WNPS))......Oracle8 Datatypes ... RNDS.......... Oracle Forms Developer: Build Internet Applications I E-9 . dnameVARCHAR2(14)........ As with package subprograms........... attributes declared in the object type specification are public and those declared in the body are private............ MEMBER PROCEDURE set_dept_id (d_id NUMBER)........... MEMBER FUNCTION get_dept_id RETURN NUMBER... RNDS....... object types can be declared in two parts: a specification and a body.. ................ A method describes the behavior of an object type..... END.WNDS................... these subprograms are known as methods.................. Here is an example of an object type: CREATE TYPE dept_type AS OBJECT (dept_idNUMBER(2). Like packages.... PRAGMA RESTRICT_REFERENCES (get_dept_id................ END. In object types...... MEMBER FUNCTION get_dept_id RETURN NUMBER IS BEGIN RETURN (dept_id).................RNPS.................. but only those whose specification appears in the object type specification are public methods..... END............WNPS)....... all methods are defined in the package body.. loc VARCHAR2(3).... Once an object is declared....... PRAGMA RESTRICT_REFERENCES (set_dept_id............. its attributes are similar to package variables..... object types can contain procedures and functions........................ Like packages..WNDS.

............................... Object Tables Object table based on object type Copyright  Oracle Corporation..... procedures..................................... The term object can be confusing because Oracle uses the term to refer to constructs within the database—for example............... Instructor Note At this point...................... tables.... 2000.......... ........ Make certain that your students are aware of the overloading of this term........ views......Appendix E: Oracle8 Object Features . They are only blueprints for objects............................................ This is a completely different usage.................................. review the fact that object types are not themselves objects........ All rights reserved.................................... E-10 Oracle Forms Developer: Build Internet Applications I ................... and so on..........................

................. Oracle Forms Developer: Build Internet Applications I E-11 ...................................................................................................... SQL and PL/SQL treat object tables very similarly to relational tables.................... Here is an example of an object table declaration: CREATE TABLE o_dept OF dept_type................Creating Oracle8 Objects ................. with the attribute of the object corresponding to the columns of the table. But there are significant differences...................... Note: REF types are reviewed later..................................... ........................ you can create objects based on the type....... Object Tables One way to create an object is to create a table whose rows are objects of that object type.......... The most important difference is that rows in an object table are assigned object IDs (OIDs) and can be referenced using a REF type......................... Creating Oracle8 Objects Introduction Once you have declared an object type............

.................................... 2000..........Appendix E: Oracle8 Object Features ................................................................... ......................................................................................... All rights reserved... E-12 Oracle Forms Developer: Build Internet Applications I .................. Object Columns Object column based on object type Copyright  Oracle Corporation.................................................................................

..................... In the object table.......................... Oracle Forms Developer: Build Internet Applications I E-13 . Here is an example of a relational table creation statement with an object column: CREATE TABLE o_customer ( custid NUMBER (6) NOT NULL...... phone phone_type)......... Object columns are not assigned object IDs (OIDs) and therefore cannot be referenced using object REF values....... the rows of a table are objects....... creditlimit NUMBER (9............................ Note: Object REFs are reviewed later in this section........................................... the column is an object....................................................Creating Oracle8 Objects ................................. address address_type........... name VARCHAR2 (45)...... repid NUMBER (4) NOT NULL... Object Columns Another construct that can be based on an object type is an object column in a relational table......2). The table will usually have standard columns................ .............. In a relational table with an object column... as well as one or more object columns........................

.......................................... 2000............................................. E-14 Oracle Forms Developer: Build Internet Applications I ................................................................................................................................................ Object Views Object-oriented application Object view Relational table Object views based on object types Copyright  Oracle Corporation................ .............Appendix E: Oracle8 Object Features ........... All rights reserved.................................

.................. the object-relational applications can operate against the object view.......................... Objects accessed through object views are assigned object IDs (OIDs). Like all views.... If such an enterprise decided to start using objectrelational technology.... Here is an example of an object view creation statement: CREATE VIEW emp_view OF emp_type WITH OBJECT OID (eno) AS SELECT e... ................. During the conversion process......empno....... This dilemma is addressed by object views....................... an object view transforms the way a table appears to a user. whereas the applications that have not been converted need the data stored in relational tables.... and can be referenced using object REFs... Oracle Forms Developer: Build Internet Applications I E-15 .job FROM emp e.. The applications that have been converted need the data stored as objects............................................... For example........Creating Oracle8 Objects ................... the relational applications can continue to operate against the relational tables.... e........ e.. That presents a problem....... e... Object views make relational tables look like object tables... Object Views Often...... without changing the actual structure of the table... This allows the developers to postpone converting the data from relational structures to object-relational structures until after all of the applications have been converted.................... It would convert the applications one at a time....................sal..... a large enterprise might have several applications accessing the same data stored in relational tables........... the most difficult part of adopting a new technology is the conversion process itself................ the enterprise would not convert all of the applications at once............... Note: Object REFs are reviewed later in this section......ename........

........................................................................................... INSTEAD-OF Triggers DECLARE BEGIN EXCEPTION END...........................................Appendix E: Oracle8 Object Features .............. All rights reserved.................................................................. Nonupdatable view INSTEAD-OF Trigger Copyright  Oracle Corporation......... .......................................... E-16 Oracle Forms Developer: Build Internet Applications I ............................. 2000...........

....... they are typically needed with object views. INSTEAD-OF triggers are activated for each row........................... and the INSTEAD-OF trigger works invisibly in the background to make the right actions take place........................................................................................... and UPDATE statements against the view................ UPDATE.................................... Note: Although INSTEAD-OF triggers can be used with any view....... the Oracle server fires the trigger instead of executing the triggering statement.... insert................. These triggers are called INSTEAD-OF triggers because... Users write normal INSERT...... The trigger performs update....................... unlike other types of triggers........................ ...... and DELETE)... DELETE....... Oracle Forms Developer: Build Internet Applications I E-17 .................Creating Oracle8 Objects ......... Object Views (continued) INSTEAD-OF Triggers INSTEAD-OF triggers provide a transparent way of modifying views that cannot be modified directly through SQL DML statements (INSERT....... or delete operations directly on the underlying tables......

................................................................................................................ ................................................................................................Appendix E: Oracle8 Object Features ................. E-18 Oracle Forms Developer: Build Internet Applications I ............................................................................

.. The attribute or column that holds the OID is of datatype REF............2)...... The stored copy of the OID then becomes a pointer..... OIDs provide an alternative method..........Referencing Objects ... it is automatically assigned a unique identifier called an object ID (OID)...................... In object-relational databases....... Note: Object columns are not assigned OIDs and cannot be pointed to by a REF... job VARCHAR2(10). Oracle Forms Developer: Build Internet Applications I E-19 ........................ to the original object.. Note: The REF is scoped here to restrict the reference to a single table..... In a similar way... you can associate a row in a relational table to an object by storing the OID of an object in a column of a relational table........ you can associate two records by storing the primary key of one record in one of the columns (the foreign key column) of another......... only the OID value for the object..... mgr NUMBER(4)............... ....2)..... dept REF dept_type SCOPE IS o_dept) ............................ or reference (REF)...... Referencing Objects Introduction In relational databases.......... O_DEPT......... ename VARCHAR2(10)........... comm NUMBER(7.......... Object REFs With relational tables.... The object itself is not stored in the table.. sal NUMBER(7............... primary key values are used to uniquely identify records............. You can associate two objects by storing the OID of one object in an attribute of another................ When a row in an object table or object view is created.......... hiredate DATE................................. Here is an example of a table declaration that includes a column with a REF datatype: CREATE TABLE o_emp ( empno NUMBER(4) NOT NULL.............

........................................................................... 2000.................Appendix E: Oracle8 Object Features ........................... Object Type Wizard Copyright  Oracle Corporation. All rights reserved..................... Object Types in Object Navigator Copyright  Oracle Corporation............. All rights reserved...................................................................... E-20 Oracle Forms Developer: Build Internet Applications I ..... ...... 2000........................................................................

............................................... This convention is used for nested object and object type displays throughout Oracle Developer........... Also................................................. Displaying Oracle8 Objects in the Object Navigator The Object Navigator lists declared types in the “Database Objects” section.................... and other Oracle objects................................................................ The wizard allows you to define the attributes and methods.. Oracle Forms Developer: Build Internet Applications I E-21 ........ Oracle8 Type Wizard Object types can be created using the Oracle8 Type Wizard.... along with tables......... views......... ......... Object Types Both the attributes and the methods are listed under each type.............. the nested types within address_and_phone_type are displayed in an indented sublevel............................Displaying Oracle8 Objects in the Object Navigator .....................................

.................. ........ All rights reserved.................................................................................................................. 2000.....................Appendix E: Oracle8 Object Features ................ Object Columns in Object Navigator Copyright  Oracle Corporation....................... 2000..... All rights reserved............................. E-22 Oracle Forms Developer: Build Internet Applications I ..................................................................... Object Tables in Object Navigator Copyright  Oracle Corporation....

Object Columns Object columns are displayed with the object type in parentheses after the column name and with the attributes of the type indented underneath the column name........................... ........ the object table type name is displayed in parentheses after the name of the object table........................ with the attributes of the object displayed like columns in a relational table..Displaying Oracle8 Objects in the Object Navigator ................................... Object Tables Object tables are displayed like relational tables... Oracle Forms Developer: Build Internet Applications I E-23 .................................................................................. Also.............................................................................................................................

........................................................................................................ ................ E-24 Oracle Forms Developer: Build Internet Applications I ...Appendix E: Oracle8 Object Features ........ All rights reserved.................................. All rights reserved................................................ INSTEAD-OF Trigger Dialog Box Copyright  Oracle Corporation........ 2000. Object Views in Object Navigator Copyright  Oracle Corporation.. 2000...................................................................................

.. the code in the trigger is executed in place of the triggering DML code... update............................................. INSTEAD-OF Triggers INSTEAD-OF database triggers can now be created through the trigger creation dialog box....... Object Views Object views are displayed like any other view...............................................Displaying Oracle8 Objects in the Object Navigator .................................................... just like any other database trigger...... UPDATE....................................... except that the object type on which they are based is written in parentheses after the view name....................... and DELETE triggers allow you to directly insert............. and delete against object views. INSTEAD-OF INSERT.................................................. see Oracle8 Server SQL Reference Manual and Oracle8 Concepts Manual... When a view has an INSTEAD-OF trigger. They can also be used with any other type of view that does not allow direct DML..... .......... Reference For more information about INSTEAD-OF triggers..... Oracle Forms Developer: Build Internet Applications I E-25 ...

...................... 2000..................................................................................................................................................................... All rights reserved........ Object REFs in Object Navigator Copyright  Oracle Corporation........ E-26 Oracle Forms Developer: Build Internet Applications I .. ......................Appendix E: Oracle8 Object Features .............................................................................

........................Displaying Oracle8 Objects in the Object Navigator .................................. display the keyword REF before the name of the object type that is being referenced.. Object REFs Object types that contain attributes of type REF.................................... The attributes of the referenced object type are displayed indented under the column or attribute..... and relational tables that have columns of type REF............................................. Oracle Forms Developer: Build Internet Applications I E-27 ........................................................................................ .......................................................................

....................................... All rights reserved...... Summary • Oracle8 introduced three scalar datatypes........ • Objects and object types allow representation of complex data....................... object columns............................... ............ and object views..................... • Three kinds of objects are object tables....... • The Object Navigator can display certain types of objects.. Summary • INSTEAD-OF triggers allow DML on object views........................................ 2000............................. E-28 Oracle Forms Developer: Build Internet Applications I ............ • Object REFs store the object identifier of certain types of objects...Appendix E: Oracle8 Object Features ....... 2000.......................................... Copyright  Oracle Corporation............................. Copyright  Oracle Corporation.. All rights reserved..

........... Object REFs store the object identifier of certain types of objects............. Objects Three kinds of objects are object tables................... Oracle Forms Developer: Build Internet Applications I E-29 ........................ INSTEAD-OF triggers allow DML on object views............... object columns................ Oracle8 Objects in the Object Navigator The Object Navigator can display certain types of objects.................. and object views............................................................... ................................................................................................ Summary Oracle8 Datatypes Oracle8 introduced three scalar datatypes and composite datatypes such as object types...................Summary ..............

................................................................................Appendix E: Oracle8 Object Features ................................................................... E-30 Oracle Forms Developer: Build Internet Applications I ................................................. .........................................................................................................

F .................... Using the Layout Editor .............

............................. All rights reserved.... Objectives After completing this lesson. ................................................... 2000..............................Appendix F: Using the Layout Editor .............................................................................................. you should be able to do the following: • Control the position and size of objects in a layout • Add lines and geometric shapes • Define the colors and fonts used for text • Color the body and boundaries of objects • Import images onto the layout Copyright  Oracle Corporation...................... F-2 Oracle Forms Developer: Build Internet Applications I ..........................................................................

.............................Overview ............. Oracle Forms Developer: Build Internet Applications I F-3 ....................................... you should be able to do the following: • Control the position and size of objects in a layout • Add lines and geometric shapes • Define the colors and fonts used for text • Color the body and boundaries of objects • Import images onto the layout Schedule Topic Lecture Timing 20 minutes Total 20 minutes ....................................................................................... Objectives After completing this lesson.............................................. you learn the graphical features of the Layout Editor common to Oracle Forms Developer and Oracle Reports Developer............................................ Overview Introduction In this lesson........... This will help you control the visual arrangement and appearance of objects in your applications....................................

................................................ Using the Layout Editor Common features: • Moving and resizing objects and text • Defining colors and fonts • Importing and manipulating images and drawings • Creating geometric lines and shapes Copyright  Oracle Corporation................................. Using the Layout Editor Layout types: • Canvases in Forms • Report layouts Copyright  Oracle Corporation................. F-4 Oracle Forms Developer: Build Internet Applications I .... All rights reserved............................................... 2000....Appendix F: Using the Layout Editor .......... ............................................... 2000......................................................................................... All rights reserved........

.. and so the associated Layout Editor appears only there......... the Layout Editor lets you plan the format of a report.............. their views might overlay others in the same window..... Oracle Forms Developer: Build Internet Applications I F-5 ...... ........... • Layouts in Reports Here........ The following are common to each tool: • Moving objects to new positions in the layout and aligning them with each other • Resizing objects and text • Defining the colors of text and visual objects • Creating lines. Its view is the portion of that canvas that is initially visible in a window at run time................................. The surfaces include: • Canvas views in Forms A canvas is the surface on which you arrange a form’s objects....................... as well as buttons........ The Layout Editor opens windows in Form Builder and Report Builder to present the surfaces on which you can arrange objects........... boxes.................................. Some objects occur only in a subset of the Oracle Forms Developer and Oracle Reports Developer tools.....Why Use the Layout Editor? .............. graphics...... and background text (boilerplate)....................................................... You can also see stacked or tabbed canvas views in the Layout Editor................... and other geometric shapes • Importing and manipulating images on the layout • Changing the font style and weight of text • Accessing the properties of objects that you see in the layout Layout Types You can use the Layout Editor to control the visual layout in Oracle Forms Developer and Oracle Reports Developer.............. You can also display stacked views in the Layout Editor..... Why Use the Layout Editor? The Layout Editor is a graphical tool for defining the arrangement and appearance of visual objects...................... This includes the frame structure of the report..............

........ Invoking the Layout Editor Copyright  Oracle Corporation........................................ 2000............................................................................ F-6 Oracle Forms Developer: Build Internet Applications I ..... Instructor Note Demonstration: • Accessing through the Tools menu • Access through the Navigator • Closing and minimizing the Layout Editor window • Reopening the Layout Editor ................................................................Appendix F: Using the Layout Editor ................................................ All rights reserved...............................................................

.. • In Reports: Double-click the Layout icon in a report hierarchy........................... In Reports................... Note: Reports has three editors—the Layout Editor.. select View—>Layout Model from the builder menu to set the context for the editor window.............................. You can do this by selecting the appropriate objects in the Navigator.............. In Forms.......... Oracle Forms Developer: Build Internet Applications I F-7 ....................................................... If you have minimized an existing Layout Editor window................ Make sure that you have the canvas that you want..How to Access the Layout Editor .................. How to Access the Layout Editor You can invoke the Layout Editor from either the builder menus or the Object Navigator.................. Opening from the Builder Menus 1 Make sure that you have a context for either a form in Forms or a report in Reports... This applies whether you are doing so for the first time in a session or at a later stage. Closing the Layout Editor You can close or minimize the Layout Editor window or windows as you would any window..... Opening from the Object Navigator • In Forms: Double-click a canvas view icon in a form hierarchy........ and the Parameter Form Editor—that are displayed in the same window.. the Data Model Editor.............................. one at a time....... you can also reacquire it in the way that you would any window............... you can open several Layout Editor windows—one for each canvas view..... select Tools—>Layout Editor from the builder menu......... 2 In Forms......... ..............

........................................ Layout Editor: Components 1 6 3 5 2 4 Copyright  Oracle Corporation..... ................................... All rights reserved.......................................................................................................................................... 2000....... F-8 Oracle Forms Developer: Build Internet Applications I .........................................................................Appendix F: Using the Layout Editor ......

A grid pattern is displayed in this area to aid alignment of objects........ Drag ruler guides from the rulers across the layout region to mark positions in the layout..Components of the Layout Editor . Note that some tools in the palette may be hidden if you have reduced the size of the Layout Editor window.................. the Main builder menu changes to include three new items: View.... You can switch off or rescale this grid if required (in Forms................................ You can switch these off or have their units altered.......... • Layout/Painting region This is the main central/right area where you can place and manipulate objects... • Horizontal toolbar This appears across the top of the window and is a subset of the tools from the Object Navigator........................... and Format................................................... • Vertical toolbar This contains the tools for creating and modifying objects on the layout.. These are submenus for controlling the Layout Editor. If so...................Product-specific tools .. they appear at the top and side of the layout region............. as required...... the grid is hidden if the View—>Show Canvas option is switched on). scroll buttons appear on the vertical toolbar. It shows you the mouse position and drag distance (when moving objects) and the current magnification level................... There are three types of tools: ........ It may also contain some other tools..........Graphics tools for creating and modifying lines and shapes ......Manipulation tools for controlling color and patterns • Rulers and ruler guides Rulers are horizontal and vertical markers to aid alignment....................... Oracle Forms Developer: Build Internet Applications I F-9 ... • Style bar This appears under the horizontal toolbar and is a subset of the Format menu........................... Arrange.................. Components of the Layout Editor Common components of the Layout Editor are: • Menu facilities While the Layout Editor window is active.... ..... • Status line This appears at the bottom of the window...

............ 2000........................................... Tool Palette 1 2 3 4 5 6 7 8 9 10 11 12 13 Copyright  Oracle Corporation.....................................Appendix F: Using the Layout Editor ..................................................... All rights reserved............................................................. F-10 Oracle Forms Developer: Build Internet Applications I .................. with text over multiple lines • Double-clicking the palette tool to retain selection ........................................... 1 Select 8 Rotate 2 Magnify 9 Reshape 3 Rectangle 10 Line 4 Ellipse 11 Arc 5 Polygon 12 Polyline 6 Rounded rectangle 13 Freehand 7 Text Instructor Note Show in the Layout Editor: • Creating a line and at least one other shape • Using the Freehand tool • Creating a circle or square using Constrained mode • Creating boilerplate text......................................

............... You can type one or more lines of text into this object while it is selected with the Text tool............... Creating and Modifying Objects in the Layout You can perform actions in the Layout Editor by selecting from the vertical toolbar and the builder menus and by controlling objects directly in the layout region................. 2 Position the mouse at the start point for the new object in the layout..............Creating and Modifying Objects in the Layout ................. a circle instead of an ellipse) by pressing the [Shift] key during step 2...... This selects the tool for a single operation on the layout (a doubleclick causes the tool to remain active for subsequent operations)........ ....... Uses of text objects vary according to the Oracle Developer tool in which you create them.. Creating Lines and Shapes Create geometric lines and shapes by selecting from the graphics tools in the vertical toolbar.................. 3 Release the mouse button................... Oracle Forms Developer: Build Internet Applications I F-11 . Creating a New Line or Shape 1 Select the required graphic tool from the vertical toolbar with a mouse click................................. Creating Text The Text tool (T) lets you open a Boilerplate Text object on the layout................ with which you can select and move objects................... Notice that the object remains selected after this procedure (selection handles appear on its boundaries) until you deselect it by clicking elsewhere............. Note: You can produce constrained shapes (for example................. and then click-and-drag to the required size and shape....... These include: • Rectangles/squares • Ellipses/circles • Polygons and polylines • Lines and arcs • Freehand tool The default tool in the vertical toolbar is Select........................................................................

....... 2000.................. All rights reserved........................................... Manipulating Objects Expand/contract in one direction Expand/contract diagonally Copyright  Oracle Corporation........................ .................................. All rights reserved...................................... F-12 Oracle Forms Developer: Build Internet Applications I ....... Selecting Objects Copyright  Oracle Corporation........................................................................ 2000................................Appendix F: Using the Layout Editor ................................

...... It is convenient to select several objects...... • Midpoint handles: Position the mouse on one of these to change the size or ratio in a horizontal or vertical direction... it is sometimes easier to use the second method........................................ an object may be transparent (No Fill)..................................... which can present a similar problem where it has no center to select................ Note: By holding down the [Shift] key.......... To select one object...... two types of selection handles are visible: • Corner handles: Position the mouse on one of these to change the size or ratio of the object diagonally................ Also...............Creating and Modifying Objects in the Layout ............................ and bit-mapped images do not become distorted when resized.............. To select several objects together................... you can resize an object without changing its ratios.............. Oracle Forms Developer: Build Internet Applications I F-13 . ................ do one of the following: • Hold down the [Shift] key and then click each object to be selected • Draw a bounding box around the objects (providing the objects are adjacent to each other) Changing the Size or Ratio When an object is selected......... Selecting Objects for Modification With the Select tool active.............. so that an operation can be performed on them simultaneously......... This means that squares remain as squares............................... you can select one or more objects on the layout to move or modify...... do one of the following: • Click the object with the mouse • Draw a bounding box around it If the object is small or narrow...

All rights reserved............................... pointing out handles • Moving an object on the layout • Lining up several objects using the Align Objects dialog box • Moving objects while grid-snap is on • How grid and grid-snap can be turned on/off and how units can be altered (pointing out the warning opposite) • Overlapping some objects and changing layering through the Arrange menu ....Appendix F: Using the Layout Editor ............... and Overlapping Copyright  Oracle Corporation................. F-14 Oracle Forms Developer: Build Internet Applications I ................. 2000................................................................................................................................................................... Moving..... Instructor Note Create your own objects to show the following: • Selecting multiple objects by [Shift] + click • Selecting by a bounding box • Losing the association after you deselect • Expanding and contracting in different directions........................... Aligning............................

............ and then try to position other objects under different settings. rightmost.................. Try to stick to the same snap units................ Oracle Forms Developer: Build Internet Applications I F-15 .. A Note on Grid-Snap Alignment You can ensure that all objects that you move align with snap points that are defined on the grid...... then one object can be seen through another (this is explained in detail later in this lesson)..... and then set the options required in the Alignment Settings dialog box............................... from the Arrange menu: • Bring to Front • Send to Back • Move Forward • Move Backward . Overlapping Objects You can position objects on top of each other............ Moving and Aligning Objects When one or more objects are selected in the layout..................... You can use the grid and ruler lines to help you position them properly......... it may prove difficult to align them with each other................................................. highest.................... You can do this using the Alignment feature in the Arrange menu: Select Arrange—>Align Objects................. or lowest object selected...... you can: • Move them to a new location: Do this by dragging to the required position and releasing the mouse button................... if you use grid-snap at all.........Creating and Modifying Objects in the Layout ......................... select View—>Snap to Grid from the menu..... You can also use the View options to change the grid-snap spacing and units......... • Align the objects with each other: Objects can be aligned with the leftmost.. They can also be centered and aligned with the grid.......... To activate these... If they are transparent.. Change the stacking order of overlapping objects by selecting the object to move and then choosing the following as required........... Note: If you position an object using one grid-snap spacing...

• Point out or mention the other grouping options (Group Operations menu)............ • Tool-specific operations exist for groups..... All rights reserved......Appendix F: Using the Layout Editor ......... Point out the single set of handles............................................. 2000................................................. Instructor Note Create your own objects to do the following: • Place some objects into a group............. • Members can be added or removed............... • Groups can be colored.... F-16 Oracle Forms Developer: Build Internet Applications I ................... • Show Undo/Redo of a Layout Editor operation from the Edit menu................................... • Demonstrate zooming in/out using the Magnify tool.. or resized.......................... Groups in the Layout • Groups allow several objects to be repeatedly treated as one.... moved............. Copyright  Oracle Corporation................ • Groups have a single set of selection handles................ and then show how they can be manipulated as one................... .........

.......... Other Tools for Manipulating Objects • Rotate: You can rotate a line or shape through an angle..... You can also reshape a polygon or polyline.................... moving.................. ............................................ The Arrange menu also gives you options to add and remove members.. Oracle Forms Developer: Build Internet Applications I F-17 ...........Creating and Modifying Objects in the Layout ... coloring.................. using the tool’s selection handles. select the group and then click the individual member............ 2 Select Arrange—>Group from the menu...................... and other operations will now apply to the group............................ You can use options in the Group Operations menu to remove objects from the group or to reselect the parent group........ Placing Objects into a Group 1 Select the objects in the layout that are to be grouped together... [Shift] + click reduces magnification........... which you can treat as a single object whenever you select a member within it....... you want to group objects together in the layout so that they behave as a single object........... Note: You can undo your previous action in the current Layout Editor session by selecting Edit—>Undo from the menu.................. Manipulating Objects As a Group Sometimes..... • Reshape: You can change size/ratio of a shape that has been rotated or change the sweep angle of an arc.... Manipulating Individual Group Members To manipulate group members individually........... Resizing............................................. You will notice there is now a single set of selection handles for the group. • Magnify: You can increase magnification when you click at a desired zoom position on the layout region....

..................................... Instructor Note Provide an overview of the Format menu options and demonstrate: • Changing the line thickness of a shape • Producing bevel effects on this shape • Changing the font size and style of boilerplate text .............................................................. Format Menu Copyright  Oracle Corporation..................... 2000.............................. All rights reserved..........................................Appendix F: Using the Layout Editor ............ F-18 Oracle Forms Developer: Build Internet Applications I ....................................................................................................

.... and the select the font style and size that you require........................................................... Changing Fonts on Textual Objects There are a number of ways to change the font characteristics of textual objects.......... Oracle Forms Developer: Build Internet Applications I F-19 ............................. The common steps provided by the Layout Editor are: 1 Select the objects in the layout whose content text you want to change (these may be boilerplate text objects and other textual object types supported by the Oracle Developer tool that you are using)................ depending on which builder you are using......... Note: In Microsoft Windows..... Formatting Objects in the Layout The builder’s Format menu provides a variety of facilities for changing the style and appearance of objects in the layout............................................. 2 Select the font style and size that you require from the style bar or select Format from the Main Builder menu..... the font choices may appear in the Format menu itself............................... style of curves and corners) Whichever formatting option you intend to use. selecting Font from the menu opens the standard Windows Font dialog................... first select the objects that you intend to change on the layout.Formatting Objects in the Layout ..................... These include: • Font sizes and styles • Spacing in lines of text • Alignment of text in a text object • Line thickness and dashing of lines • Bevel (3D) effects on objects • General drawing options (for example.... Font settings are ignored if the application is run in character mode.......... ....... and then choose the necessary option from the Format menu.......... Some of the format options are available from the style bar. In other GUI environments..............................

.................................................................................................................... F-20 Oracle Forms Developer: Build Internet Applications I ......................Appendix F: Using the Layout Editor ............................................................................. 2000....................... 1 Sample window 2 Fill color/pattern 3 Line color 4 Text color ...................................... Color and Pattern Tools 1 2 3 4 Copyright  Oracle Corporation............... All rights reserved.............

..... Select No Line at the bottom of this window to remove the objects’ boundary lines.... Coloring an Area 1 Select the objects whose color you want to change.... the affected objects become invisible.................. another window appears with patterns for you to choose............. ................. The color palette appears......... 4 If you select Patterns..............Coloring Objects and Text ... • Text Color: Use this tool to choose the color for the text............ Coloring Objects You can separately color the fill area (body) of an object and its boundary line (a line object has no body).................. These are: • Fill Color: Use this tool to define the colors and pattern for an object’s body...... and follow the next step............. If you want the objects to become transparent. 2 Select the Fill Color tool.................. Note: If you set both No Fill and No Line..... 3 Select a color from those visible.. 2 Select the color for lines and bounding lines from this color palette....... Coloring a Line 1 With the desired layout objects selected................................................ If you want the fill area to be patterned instead of plain................... Coloring Objects and Text There are three tools in the vertical toolbar for coloring objects...... • Line Color: Use this tool to define the color of a line or the boundary line around an object.. click the Line Color tool................. You can define separate colors for the two shades of the pattern by selecting the pattern color buttons at the bottom of the Fill Pattern palette.......... then select Patterns from the bottom of the color palette.... Oracle Forms Developer: Build Internet Applications I F-21 ........ The color palette opens.... select No Fill at the bottom of the color palette window............... each button opens a further color palette..... Select one....................

......... All rights reserved..................................................................... Color and Pattern Tools 1 2 3 4 Copyright  Oracle Corporation.. F-22 Oracle Forms Developer: Build Internet Applications I ........................................................................................................................................... 1 Sample window 2 Fill color/pattern 3 Line color 4 Text color Instructor Note Show the following: • Coloring the body of a shape • Changing the fill pattern and how elements of the pattern can be colored • Making an object transparent and how other objects can then be seen through it • Coloring lines and removing them completely • Coloring text • How color palettes can be torn off and repositioned • How color settings are retained in the Layout Editor • How to modify the color palette ..........................Appendix F: Using the Layout Editor .................................................... 2000.......

...... This indicates the current text color setting................................... Note: Modifications to the color palette will not be apparent until you close the document and reopen it............ 4 Notice that the selected objects on the layout have adopted the chosen text color.............. Coloring Text 1 Select the textual objects whose color you want to change in the layout...................................................... Oracle Forms Developer: Build Internet Applications I F-23 ........................................ the sample area in the vertical toolbar shows a T with the selected color.. and this color appears next to the Text Color tool....... you can edit the color palette that is presented when selecting colors........ 3 Select a color from those shown (click the appropriate square).....Coloring Objects and Text .................... .. This option is available only when the builder option Color Palette Mode is set to Editable.......... Altering the Color Palette By selecting Format—>Layout Options—>Color Palette from the menu.......... Changes to the color palette are saved with the current module.......................... The color palette appears......... Also............................................. showing the available colors...... 2 Select the Text Color tool.....

...................................................... Recommend using summitlo...................tif................................ Instructor Note Show how to import an image from the file system........... 2000............................. ..................... pointing out the various file formats that are supported............................. F-24 Oracle Forms Developer: Build Internet Applications I .Appendix F: Using the Layout Editor ......... All rights reserved................................................ Importing Images Copyright  Oracle Corporation........................... Show that boilerplate images can be moved and resized on the layout.............................

.... CALS...... . and set the Import Image options: Option (Radio buttons) File/Database Filename Format Quality Description Where to import from File to be imported Image format (BMP..... This section discusses how you can import static images and drawings—that is..... TIFF............................................. PCX.................. This is a trade-off between image resolution and memory required... Oracle Format............................... you can move it or resize it like other objects on the layout......................... Importing Images Select File—>Import—>Image from the menus..... Importing Images and Drawings Oracle Forms Developer and Oracle Reports Developer allow both static and dynamic bit-mapped images to be integrated into the application.. RAS..................... those that are fixed on the layout.................. GIF........ and specify the source in the Import dialog box........ It is usually better to resize images in Constrained mode (while pressing the [Shift] key) so the image does not become distorted... PICT. Select File—>Import—>Drawing from the menus............. The format can be Oracle or a CGM file.................... Manipulating the Imported Image or Drawing When the imported image or drawing appears on the layout........ These might include: • Company logos • Photographs for inclusion in a report or display • Background artwork Importing Drawings You can import line art onto the layout from either the file system or the database........... and PCD [Kodak Photo CD]) Range from Excellent to Poor.........................Importing Images and Drawings .................................. Oracle Forms Developer: Build Internet Applications I F-25 ..

• You can import images and drawings by using File—>Import.............. All rights reserved........................................ Arrange... Copyright  Oracle Corporation................................................. 2000....... lines......... • Objects can be grouped for operations................................................................................... • View........................ and Format menus are available for layout..... Summary • You can create objects by: – Choosing a palette tool – Clicking and dragging on a layout region • There are color palette tools for fill area....Appendix F: Using the Layout Editor ............. and text.......................... F-26 Oracle Forms Developer: Build Internet Applications I .............................. .....

............................................. View..... .......... Arrange........Summary .........................................Choosing the correct toolbar tool ...................... You can import images and drawings by selecting Edit—>Import.............. and Format menus are available while you are in the Layout Editor........ Summary • • • • • You can create objects by: ................................................. lines................. You can group objects for operations. Oracle Forms Developer: Build Internet Applications I F-27 .................................... and text.........................................Clicking and dragging the layout region There are color palette tools for fill area..............

................................................................................................Appendix F: Using the Layout Editor ................................................................................................. .................................. F-28 Oracle Forms Developer: Build Internet Applications I ..........................................................................

...............G ...... Introduction to Query Builder ............

..........Appendix G: Introduction to Query Builder ............................. Query Builder Features • • • • Easy-to-use data access tool Point-and-click graphical user interface Distributed data access Powerful query building Copyright  Oracle Corporation................................. G-2 Oracle Forms Developer: Build Internet Applications I ............................................................................................ .................................... All rights reserved.................................... 2000...................................................................

.. enterprisewide databases is no more difficult than querying a single database. • Locating database objects is easy because Query Builder uses a single hierarchical directory that lists all accessible data in your account............................ in other accounts........................... which look and work exactly the same way regardless of which database or account the data came from......... .......................................... distributed databases for analysis and reporting.............................. Distributed Data Access Query Builder represents all database objects (tables........... What Is Query Builder? Easy-to-Use Data Access Tool Query Builder is an easy-to-use data access tool...................................................What Is Query Builder? ............... and in other databases................... • Performing distributed queries on complex...................... Point-and-Click Graphical User Interface Query Builder enables you to become productive quickly because its graphical user interface works like your other applications.......... and so on) as graphical datasources..... views.......... A toolbar enables you to perform common operations quickly............. Oracle Forms Developer: Build Internet Applications I G-3 .............. It provides a logical and intuitive means to access information stored in networked.....

........................ 2000.............................................. All rights reserved.. G-4 Oracle Forms Developer: Build Internet Applications I .................... Query Builder Features • • • • Easy-to-use data access tool Point-and-click graphical user interface Distributed data access Powerful query building Copyright  Oracle Corporation...................... ........................Appendix G: Introduction to Query Builder .....................................................................................................................................................................

.... Powerful Query Building Query Builder is designed for professionals who do not have a computer programming or database background............................ because of its powerful query features and its support of Structured Query Language (SQL) statements................... which consist of any valid SQL expression that evaluates to true or false.................................................. This appendix describes Query Builder as part of tools such as Report Builder........ Note: Query Builder as a tool in itself also includes WYSIWYG formatting and reporting capabilities................................................ experienced database users and programmers will find that Query Builder serves many of their needs as well............. You can disable conditions temporarily for what-if analysis......... • You can combine and nest conditions graphically using logical operators........What Is Query Builder? ...................... The browser generates the necessary SQL statements behind the scenes................................. ... Oracle Forms Developer: Build Internet Applications I G-5 ..... • You can build queries by clicking the columns that you want to retrieve from the database...... However........... • You can specify exactly which rows to retrieve from the database by using conditions........................... • Graphical representation of tables and their relationships enables you to see the structure of your data...................

....... 1 2 3 Toolbar Conditions panel Datasource panel ..................................................................................................................... Query Builder Window 1 Copyright  Oracle Corporation.. All rights reserved........... 2000............................................... G-6 Oracle Forms Developer: Build Internet Applications I ......................................................................................................................Appendix G: Introduction to Query Builder .

................... .............................. add new datasources. Oracle Forms Developer: Build Internet Applications I G-7 ....... The Query Builder Window The Query Builder graphical user interface consists of one window.............................................................. the Query window........................................................... Query Window Panels The Query window is divided into two panels: • The Conditions panel where you specify conditions to refine your queries • The Datasource panel where you display and select tables and columns for a query Toolbar The toolbar enables you to issue commands with a click of the mouse....The Query Builder Window ................ or define new columns................................................................ where you build your queries............................. You can create conditions................

.. All rights reserved..........................................Appendix G: Introduction to Query Builder ............................................................................................................................................. ....................................................... 2000............ Building a New Query Copyright  Oracle Corporation... G-8 Oracle Forms Developer: Build Internet Applications I ................................................

................................ or simply double-click the desired table name................... Oracle Forms Developer: Build Internet Applications I G-9 ........ 3 Click Close to close the dialog box. 2 Select Clear from the toolbar or press [Delete].......... How to Include a Table 1 Choose Select Data Tables from the toolbar......................................................... ....................... How to Delete a Table 1 Select the data source in the Query window........................................... The selected table appears in the Query window..... you must select the tables you want to include and the columns you want to retrieve... 2 Select the table name and then click Include.................... You can at any time include additional tables in the query by following these steps................. Note: When you open Query Builder to create a new query..........................Building a New Query ............... Building a New Query To build a query............................ the Select Data Tables dialog box is open by default..... The Select Data Tables dialog box appears.

.............. 1 2 3 4 Datasource name Primary key Column name Foreign key 5 6 7 8 Object type Column datatype Recursive relationship icon Comments icon ....... G-10 Oracle Forms Developer: Build Internet Applications I ............. 2000........................................................................................................................Appendix G: Introduction to Query Builder .................................................................................................................. Datasource Components 1 5 2 6 3 7 8 4 Copyright  Oracle Corporation............. All rights reserved......................

......... ....................... or a join of two or more tables........ Type Table View Synonym Alias Description Stores data in the database........ Columns The body of the rectangle contains column names listed vertically.... Acts like a table when you execute a query............................. Datasource Components Tables A table that has been included in a query is referred to as a datasource.............. • Primary keys are displayed in bold. such as emp_em_con_tbl......................... Another name for an object. mostly with self-joins (you can also rename a table)............... Oracle Forms Developer: Build Internet Applications I G-11 .......... but is really a pointer to either a subset of a table.......................................... Query Builder uses an alias name for a table when the table is used more than once.... You can create a synonym that simply calls this table Contracts.......Datasource Components ......... The top part of the rectangle contains the table name and an icon representing its type.......................................... To the right of the column name is an icon representing the datatype. • Recursive relationships are indicated by a self-relationship icon.................. Columns also provide additional information... It is displayed as a rectangular graphic in the Datasource panel of the Query window.. a combination of tables.......... • Foreign keys are displayed in italics.................. Sometimes table names can be rather cryptic.................

.............................................. All rights reserved...................................................................... .................................................................................................. G-12 Oracle Forms Developer: Build Internet Applications I ........ 2000.............................Appendix G: Introduction to Query Builder ..................... Refining a Query Copyright  Oracle Corporation...............................

. Note: You can also use the Column Sequence dialog box to add columns to or remove them from a query. double-click the table heading......... Removing Columns to a Query There are several methods of removing columns to a query: • Clear the check box to the right of the column name • Double-click the column name To remove all columns from any single table............................................... Changing Column Position in a Query By default....... Query Builder places columns in the order in which you select them................................... Drag any column to a new position.......Refining a Query ............................................ Oracle Forms Developer: Build Internet Applications I G-13 .............................................................................. Column names are shown in the Displayed Columns list in order of their appearance in the query................ double-click the table heading............ The Column Sequence dialog box appears...... You can resequence them by selecting the Column Sequence tool......... ........................... Refining a Query Adding Columns to a Query There are several methods of adding columns to a query: • Select the check box to the right of the column name • Double-click the column name To include all columns from any single table............

................ Sorting Data Copyright  Oracle Corporation................................................ All rights reserved.................. G-14 Oracle Forms Developer: Build Internet Applications I ................................................................................... .............Appendix G: Introduction to Query Builder .................... 2000.........................................................................................................

...................... The Sort dialog box appears....... you must add an ORDER BY clause to the query....................... Note: You can sort by more than one column............................................. a query returns the data in no specific order.......... To sort the data... ..............Refining a Query ...................................................... Oracle Forms Developer: Build Internet Applications I G-15 ............. 5 Select OK to close the dialog box..... 2 Select the column you want to sort from the Available Columns list........................................................ Sorting Data By default. Query Builder adds the column to the Sorted Columns list and places an up arrow in the list box to indicate the default sort ascending order................. 4 You can change the sorting order by selecting the column name in the Sorted Columns list and selecting the desired option button. 3 Select Copy................................. How to Add an ORDER BY Clause to a Query 1 Select the Sort tool........ Query Builder sorts according to the order in which columns appear in the Sorted Columns list.

................................... All rights reserved............................................................................ .......Appendix G: Introduction to Query Builder .................................... Viewing and Saving Queries Copyright  Oracle Corporation................ 2000.... G-16 Oracle Forms Developer: Build Internet Applications I .................................................................................................................................

................................................ 2 Enter a filename........SQL file extension.............................. 1 Select the Save tool from the toolbar......... How to Save a Query You can save your query as a SQL statement to the file system................................. Oracle Forms Developer: Build Internet Applications I G-17 ... Viewing and Saving Queries Viewing a Query Select the Show SQL tool to view the query text that Query Builder will create....... 4 Click OK................................................... Query Builder automatically appends the .......................................................... 3 Select a destination................... ........... Note: If you do not enter a file extension....Viewing and Saving Queries ......... The Save As dialog box appears....................

..... G-18 Oracle Forms Developer: Build Internet Applications I ............................Appendix G: Introduction to Query Builder .......................................... ........................................................... All rights reserved.......................................................... 2000........................................... Including Additional Tables Copyright  Oracle Corporation....................................................................

.......... How to Find Tables in Other Accounts If you do not find the table you are looking for in the Select Data Tables dialog box in your own account...................... 3 Select the name of the database in the list and then click Open......... you can include multiple tables in a single query......... ................. or simply doubleclick the account name.................. 2 Select databases.......... You can also use this dialog box to show only certain types of datasources as well as datasources in other accounts and databases..................... 2 Select the current database name.. or simply doubleclick the account name....... 1 Open the pop-up menu to display the name of the current database and the option databases... you can search other accounts..... 3 Select the name of the account in the list and then click Open......... How to Find Tables in Other Databases If you do not find the table you are looking for in the Select Data Tables dialog box in your own account..................................... 4 Follow the normal procedure for including tables in the Query window....Including Additional Tables ... Including Additional Tables Often............. all of the data needed to create a desired report cannot be found in a single table........................................ you can search other databases...... This opens the account and displays a list of tables in the account.......... 1 Open the pop-up menu to display the name of the current database and the option databases...... The list box displays a list of databases you can access............................ Remember that you can see the names of all the tables in your account by choosing the Select Data Tables tool. Oracle Forms Developer: Build Internet Applications I G-19 .. This brings up the Select Data Tables dialog box............ The list box displays a list of accounts that contain tables you can access.......... 4 Follow the normal procedure for including tables in the Query window...... With Query Builder....

All rights reserved....................................................................................................................................... 2000............................... ................... Viewing Comments Copyright  Oracle Corporation...............Appendix G: Introduction to Query Builder ............................................................................... G-20 Oracle Forms Developer: Build Internet Applications I ........................

....................... How to View Comments Sometimes............................................................. you can double-click the Comment icon in each table or column in the Datasources panel........ details about the kind of data stored in the database are not reflected by the table or column names........................ ........................................... Oracle Forms Developer: Build Internet Applications I G-21 ........ select the table or column name............... To open the dialog box............. Alternatively.......................... 2 Select the Get Info tool......... This can often make it difficult to decide which objects to include in your query....................Including Additional Tables .................................. follow these steps: 1 In the Datasource panel...... Query Builder features the Get Info dialog box to provide this kind of information for tables and columns....................

............................................... G-22 Oracle Forms Developer: Build Internet Applications I ..........Appendix G: Introduction to Query Builder ...................................... 2000............................................................ ............................................................ All rights reserved................................................................... Including Related Tables Copyright  Oracle Corporation.....................

.................... How to Find and Include Related Tables 1 Select the table in the Datasource panel.... or simply double-click the table name.................... Relationships between the tables are identified by relationship lines... Oracle Forms Developer: Build Internet Applications I G-23 ......... Query Builder enables you to search for relationships between tables and to create user-defined relationships if they do not exist... 3 Select the table name and click Include................................ Relationships To combine data from multiple tables into one query........Relationships ......................................... Once you have included the table............................... drawn from the primary keys in one table to the foreign keys in another............. only the table to which the foreign key refers appears in the Select Related Tables dialog box.... 2 Choose the Select Related Tables tool.............. ........................ you can activate or deactivate relationships to suit your needs.......... Additionally.............................. A list of tables that have relationships defined with the selected table appears.... The selected table appears in the Datasource panel..... 4 Click Close to close the dialog box................... you can retrieve its columns............ Note: When you select a foreign key column before selecting related tables...........

................................................... Creating a User-Defined Relationship Copyright  Oracle Corporation.................. 2000.. All rights reserved....... G-24 Oracle Forms Developer: Build Internet Applications I ...............................Appendix G: Introduction to Query Builder ............................................ ......................................................................................................................................................

............... 2 While holding down the mouse button.............. 3 Once the target column is selected.......................... 3 Type the complete table and column names (separate the table name from its column name with a period)........ Creating a User-Defined Relationship When you create a user-defined relationship................................ 2 Enter the foreign key (A—>) and primary key (B—>) column names............. How to Create a Relationship (Optional Method) 1 Select the column that you want to relate (foreign key)................ drag the cursor to the related column in the second table (the primary key). ............ Query Builder draws a relationship line connecting the related columns............... How to Create a Relationship 1 Select the Set Table Relationship tool............................................Relationships .... 4 Click OK to close the dialog box......... release the mouse button to anchor the relationship line..... Oracle Forms Developer: Build Internet Applications I G-25 .................... The Set Relationship dialog box appears.... You are drawing a relationship line as you do so...........................................................................

........................................................................................................................................................ All rights reserved..........................................Appendix G: Introduction to Query Builder ........ 2000............................ ...... G-26 Oracle Forms Developer: Build Internet Applications I ............................................................. Unmatched Rows Copyright  Oracle Corporation......

.. An unmatched relationship icon is placed on the relationship line next to the column that returns unmatched rows........ ................... Both the column names and the relationship line should be selected.................... 2 Select the Set Table Relationship tool from the toolbar.............................................Relationships .. There are three types of relationships that you can choose from: • Display records from table A not found in table B • Display records from table B not found in table A • Suppress any mismatched records (default) How to Create an Unmatched Relationship 1 Click on the relationship line that connects the tables......................... Retrieving Unmatched Rows Query Builder lets you choose whether to retrieve any unmatched rows when you are using a relationship in a query..................................................... 3 Choose one of the three relationship option buttons............. Oracle Forms Developer: Build Internet Applications I G-27 ....... An unmatched row occurs when the relationship connects tables where there are values on one side that have no corresponding values on the other side.. 4 Click OK................................................... The Set Relationship dialog box appears..............................................................

......................... G-28 Oracle Forms Developer: Build Internet Applications I ........................ .............. 2000................................................................................................................................ Conditions Copyright  Oracle Corporation......................Appendix G: Introduction to Query Builder .......................... All rights reserved................................................................

... ......... You can close the Condition field in the following ways: • Press [Return]..... The Datasource panel is where you include tables and columns. Or Select columns and functions.... 3 Close and validate the condition.. Type the conditions directly into the Condition field........... • Select Accept from the toolbar..... Selecting Rows with Conditions The Conditions Panel The Query window contains two independently scrollable panels.................................... Closing and Validating the Condition Query Builder automatically validates the condition when you close the Condition field.............. The Conditions panel is where you apply conditions................... You can insert an operator from the toolbar into the condition by clicking it...............................Selecting Rows with Conditions ......... Or Click in the columns in the Datasource panel and enter the rest of the condition..................... using the appropriate tools............... the Conditions panel and the Datasource panel.... • Click in the Conditions panel outside the Condition field... Note: Character and date values must be enclosed in single quotes. You enter conditions into the Condition field of the panel........................................ 2 Enter the text that describes the condition.................................. Oracle Forms Developer: Build Internet Applications I G-29 ..... The Toolbar The logical operators and the Accept and Cancel tools in the toolbar are active whenever the Condition field is active......... a gray check mark appears to the left of the column name in the datasource in the Query Window............. How to Add Conditions to a Query 1 Activate the Conditions field........................ Note: If a column is used in a condition but it is not displayed in the results window...

......................................... x................... AND Copyright  Oracle Corporation................................................. BETWEEN .. IN................................Appendix G: Introduction to Query Builder ........ NOT Comparison • Compare one expression with another • Examples: =..... All rights reserved........ OR......... / Logical • Combine conditions • Examples: AND.................................. .................... <..................................... G-30 Oracle Forms Developer: Build Internet Applications I .... -....... IS NULL......... <>............... Operators Arithmetic • Perform calculations on numeric and date columns • Examples: +............... 2000..

....................................... A row without a value in one column is said to contain a NULL value................ Operator = <> < <= > >= BETWEEN............ x......... In handling calculations........... Arithmetic Operators Arithmetic (+...................... such as the + operator....... Oracle Forms Developer: Build Internet Applications I G-31 ......................................... which performs addition.... AND.. Query Builder uses several types of operators..Operators ..................... and then evaluates any addition or subtraction... They include: • AND: Causes the browser to retrieve only data that meets all conditions • OR: Causes the browser to retrieve all data that meets at least one of the conditions • NOT: Used to make a negative condition...... Query Builder first evaluates any multiplication or division.................... IN (LIST) IS NULL Usage Equal Not equal Less than Less than or equal Greater than Greater than or equal Between two values Equal to any member of the following list Is a NULL value.................... -... such as NOT NULL Comparison Operators Comparison operators are used to compare one expression with another....... ........................... The browser returns all data for which the result evaluates true............. such that the result will either be true or false... Logical Operators Logical operators are used to combine conditions..... Operators An operator is a character or reserved word that is used to perform some operation in Query Builder....... /) operators are used to perform calculations on numeric and date columns........................

................................... 2000.................. Multiple Conditions Copyright  Oracle Corporation...................Appendix G: Introduction to Query Builder ............................ .............. All rights reserved................................................................................................................................... G-32 Oracle Forms Developer: Build Internet Applications I ..........................................................

2 Click a new operator on the toolbar or select one from the Data menu.. 3 Select the logical operator to combine the conditions—either AND or OR...... To change the logical operator: 1 Select the logical operator in the Conditions panel....................................... a new blank Condition field is created...... 1 Click in the empty Condition field to activate it.... You can add conditions to any query either before or after execution..... How to Create Nested Conditions Query Builder enables you to combine logical operators to produce complex queries made up of multiple levels of conditions. 3 Press [Return] to close and validate the condition.......................................................... Oracle Forms Developer: Build Internet Applications I G-33 ............. How to Change Logical Operators By default... because it moves the cursor and prompt down one line so that you can enter another condition..... These are referred to as nested conditions........ click in the box to the left of each condition to be nested.................... 2 While holding down the [Shift] key...... Query Builder draws a box around the highlighted conditions in the Conditions panel and combines them with the operator that you specified.. ................................ How to Add Conditions The Conditions panel always displays a blank Condition field at the bottom of the list of conditions.............. Each time you add a condition.................. Use this field to enter multiple conditions..... 2 Enter the new condition..............Entering Multiple Conditions .... Query Builder combines multiple conditions with the AND operator......... Multiple conditions are always combined using logical operators................... Entering Multiple Conditions There is no limit to the number of conditions you can include in a browser query........ To nest two or more conditions: 1 Build each condition to be included in the nest......... Note: Pressing [Shift]-[Return] following the entry of each condition is the fastest way to create multiple conditions.............

................................................................................................................................................ .....................Appendix G: Introduction to Query Builder ........... G-34 Oracle Forms Developer: Build Internet Applications I ............................................................... Deactivating a Condition Copyright  Oracle Corporation.......... All rights reserved.................................. 2000....................

.............. How to Delete a Condition 1 Click inside the Condition field to activate it...Changing Conditions ........................................................... Deactivated conditions remain in the Condition field but appear dimmed...... Oracle Forms Developer: Build Internet Applications I G-35 ..... alternately turning the condition on and off................... you can delete. you can turn conditions on and off by using the Data menu: 1 Select the box to the left of the condition or its operator............ The condition is removed from the query................ or edit any of them in the Conditions panel............. .................. Double-clicking the box to the left of the condition or its operator acts as a toggle switch...... Changing Conditions If you change your mind about including one or more conditions in your query.................................................................................... 2 Select Clear from the toolbar or select Delete....... How to Deactivate a Condition Query Builder enables you to temporarily deactivate a condition so that you can test different scenarios without having to re-create the conditions each time.. Note: Hold down the [Shift] key to select multiple conditions........ deactivate..... Additionally..... 2 Double-click in the box to deactivate the condition................................

............................................. .................................... Defining Columns Using an Expression Copyright  Oracle Corporation................ G-36 Oracle Forms Developer: Build Internet Applications I ..........................................Appendix G: Introduction to Query Builder .................. 2000.................................................................................................................. All rights reserved................................

.. Oracle Forms Developer: Build Internet Applications I G-37 .................... which displays a list of all columns currently defined in the query (if any).... – Select the column from the displayed list........................... 5 Select Define.... 2 Select the Define Column tool.................................. it exists only in your query................................................. 3 Click in the Defined Column field to activate it. The Paste Column dialog box appears.............Defining Columns Using an Expression ........ 1 Select the table where you want to define a new column........ The new column is added to the list of defined columns in the dialog box and appears in the Datasource panel........... and then enter the name for your new column........................ How to Display and Hide Defined Columns You display or hide defined columns from a query in exactly the same manner as you do ordinary columns..................... 6 Click OK to close the dialog box. How to Define a Column When you define a column.... Defining Columns Using an Expression Besides retrieving columns of data stored in a table........... ........... not in the database... • Select Paste Column..... 4 Move your cursor to the Defined As field and enter the formula or expression that defines your column..... How to Enter Expressions You can enter information in the Defined As field in the following ways: • Type the expression in directly.............. Query Builder enables you to define new columns that are derived or calculated from the values in another column. – Click OK to paste the column into your expression and return to the Define Column dialog box...................................... The Defined Column dialog box appears..

.................................................................................................Appendix G: Introduction to Query Builder .......... All rights reserved.................. ........................................................................ Defining Columns Using a Function Copyright  Oracle Corporation....... G-38 Oracle Forms Developer: Build Internet Applications I ................... 2000................................................................................

.. SUM() How to Select a Function 1 Click in the Defined As field to activate it................ SUBSTR()... Oracle Forms Developer: Build Internet Applications I G-39 .....Defining Columns Using a Function .... Functions consist of a function name followed by parentheses........................ What Is a Function? A function is similar to an operator in that it performs a calculation and returns a result........ You then replace the description with the actual arguments......... . An argument is an expression that supplies information for the function to use.... 6 Click OK to paste the function into your expression and return to the Define Columns dialog box......................................... 5 Select the Paste Arguments check box (optional)... Note: If this check box is selected....... or select Paste Function to select from a list........................................ Functions usually include at least one argument.................. a description or datatype name of the arguments appropriate for the function is pasted into your expression...... TRUNC() Aggregate Functions • Return a single row based on the input of multiple rows of data • Examples: AVG().......................... You can type a function directly in the Defined As field of the Define Columns dialog box........ 3 Select or deselect the Show Categories check boxes to view the desired list of functions............ Single-Row Functions • Return one value for every data row operated on • Examples: INITCAP().............................................. Defining Columns Using a Function The browser also enables you to define columns using a variety of built-in functions provided by the Oracle Server..... in which you indicate the arguments. The Paste Function dialog box appears. COUNT()............... 4 Select the function from the displayed list.............. 2 Select Paste Function... most commonly the name of the column on which the operation will be performed.

................................................................................. G-40 Oracle Forms Developer: Build Internet Applications I ....................... ...................................................................................................................................................................................Appendix G: Introduction to Query Builder .................

Sign up to vote on this title
UsefulNot useful

Master Your Semester with Scribd & The New York Times

Special offer for students: Only $4.99/month.

Master Your Semester with a Special Offer from Scribd & The New York Times

Cancel anytime.