Professional Documents
Culture Documents
40033GC10
Production 1.0
March 2000
M011344
Author
Ellen Gravina
David Ball
Soley Celik
Kathy Cunningham
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
.....................................................................................................................................................
2-9
4-27
.....................................................................................................................................................
iv
Oracle Forms Developer: Build Internet Applications I
Contents
.....................................................................................................................................................
.....................................................................................................................................................
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
.....................................................................................................................................................
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
.....................................................................................................................................................
13-19
.....................................................................................................................................................
viii
Oracle Forms Developer: Build Internet Applications I
Contents
.....................................................................................................................................................
17-7
19-15
.....................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
ix
Contents
.....................................................................................................................................................
.....................................................................................................................................................
x
Oracle Forms Developer: Build Internet Applications I
Contents
.....................................................................................................................................................
.....................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
xi
Contents
.....................................................................................................................................................
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
.....................................................................................................................................................
xii
Oracle Forms Developer: Build Internet Applications I
Contents
.....................................................................................................................................................
F-11
.....................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
xiii
Contents
.....................................................................................................................................................
.....................................................................................................................................................
xiv
Oracle Forms Developer: Build Internet Applications I
15
................................
Adding Functionality
to Items
Lesson
15: Adding Functionality to Items
......................................................................................................................................................
Objectives
Schedule
Topic
Lecture
Practice
Total
Timing
40 minutes
40 minutes
80 minutes
......................................................................................................................................................
15-2
Oracle Forms Developer: Build Internet Applications I
Introduction
......................................................................................................................................................
Introduction
Overview
In this lesson, 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
Lesson
15: Adding Functionality to Items
......................................................................................................................................................
Instructor Note
The When-Image-Pressed trigger fires when the user clicks the image. The
When-Image-Activated trigger fires when the user double-clicks the image. The
mouse-event triggers, When-Mouse-Click and When-Mouse-Doubleclick, may also
exist within the scope of the objects discussed here. In this case, the mouse-event
triggers fire after the item interaction trigger, when the mouse is used by the user.
......................................................................................................................................................
15-4
Oracle Forms Developer: Build Internet Applications I
Firing Event
User single-clicks with mouse or uses
function key to select
User changes check box state, by
single-click or function key
User selects different button, or deselects
current button, 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
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
15-5
Lesson
15: Adding Functionality to Items
......................................................................................................................................................
Valid commands:
SELECT statements
Standard PL/SQL constructs
All built-in subprograms
Instructor Note
Use the orders.fmb file to show the When-Radio-Changed trigger on
Payment_Type of the S_ORD block.
Run the customer.fmb file to show the functionality of the trigger.
Use Customer ID 214, because this customer has a poor credit rating.
Explain the actions in the trigger code.
We will discuss using SELECT statements in triggers in the lesson on
query triggers.
......................................................................................................................................................
15-6
Oracle Forms Developer: Build Internet Applications I
Example of When-Radio-Changed
When-Radio-Changed trigger on :S_ORD.Payment_Type. When the user selects
credit as the payment type for an order, this trigger immediately confirms whether the
customer has a good or excellent credit rating. If not, then the payment type is set to
cash.
DECLARE
v_credit_rating S_CUSTOMER.credit_rating%TYPE;
BEGIN
IF :S_ORD.payment_type = CREDIT THEN
SELECT credit_rating INTO v_credit_rating
FROM S_CUSTOMER
WHERE id = :S_ORD.customer_id;
IF v_credit_rating NOT IN(GOOD,EXCELLENT) THEN
:S_ORD.payment_type := CASH;
MESSAGE(Warning-customer must pay cash);
END IF;
END IF;
END;
Note: During an unhandled exception, the trigger terminates and sends the Unhandled
Exception message to the operator. The item interaction triggers do not fire on
navigation or validation events.
Command Types in Item Interaction Triggers
You can use standard SQL and PL/SQL statements in these triggers, like the example
above. However, you will often want to add functionality to items by calling built-in
subprograms, which provide a wide variety of mechanisms.
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
15-7
Lesson
15: Adding Functionality to Items
......................................................................................................................................................
When-Checkbox-Changed
IF CHECKBOX_CHECKED(S_ORD.order_filled) THEN
SET_ITEM_PROPERTY(S_ORD.date_shipped,
UPDATE_ALLOWED, PROPERTY_FALSE);
ELSE
SET_ITEM_PROPERTY(S_ORD.date_shipped,
UPDATE_ALLOWED, PROPERTY_TRUE);
END IF;
......................................................................................................................................................
15-8
Oracle Forms Developer: Build Internet Applications I
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
15-9
Lesson
15: Adding Functionality to Items
......................................................................................................................................................
Excellent
ADD_LIST_ELEMENT
DELETE_LIST_ELEMENT
Excellent
Good
Poor
Index
1
2
3
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
List Items
You can use the When-List-Changed trigger to trap user selection of a list value. For
Tlists, you can trap double-clicks with When-List-Activated.
With Form Builder, you can also change the selectable elements in a list as follows:
Periodically update the list from a two-column record group.
Add or remove individual list elements through the
ADD_ LIST_ELEMENT and DELETE_LIST_ELEMENT built-ins,
respectively.
ADD_LIST_ELEMENT(list_item_name,index,label,value)
DELETE_LIST_ELEMENT(list_item_name,index)
Parameter
Description
Index
Label
Value
Note: You can eliminate the Null list element of a list by setting the required property
to Yes.
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
15-11
Lesson
15: Adding Functionality to Items
......................................................................................................................................................
Uses:
Convenient alternative for accessing LOVs
Can display independently of text items
Needs:
When-Button-Pressed trigger
LIST_VALUES or SHOW_LOV built-in
Instructor Note
Use LIST_VALUES with one button for each item that has a LOV.
Use SHOW_LOV with a single button for the whole form.
In both cases, set the Keyboard Navigable and Mouse Navigate properties of the
button to No.
......................................................................................................................................................
15-12
Oracle Forms Developer: Build Internet Applications I
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
......................................................................................................................................................
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
......................................................................................................................................................
15-14
Oracle Forms Developer: Build Internet Applications I
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
15-15
Lesson
15: Adding Functionality to 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
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
......................................................................................................................................................
READ_IMAGE_FILE(
F_||TO_CHAR(:S_ITEM.product_id)||.BMP,
BMP,
S_ITEM.product_image );
......................................................................................................................................................
15-18
Oracle Forms Developer: Build Internet Applications I
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
......................................................................................................................................................
SHOW_FAST_FORWARD_BUTTON
SHOW_PLAY_BUTTON
SHOW_RECORD_BUTTON
SHOW_REWIND_BUTTON
SHOW_SLIDER
SHOW_TIME_INDICATOR
SHOW_VOLUME_CONTROL
......................................................................................................................................................
15-20
Oracle Forms Developer: Build Internet Applications I
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
15-21
Lesson
15: Adding Functionality to Items
......................................................................................................................................................
Record Group
When-New-Form-Instance
Car
SET_TREE_PROPERTY
Ford
Volvo
VW
Toyota
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
Description
item_name
Specifies the name of the object created at design time. The data type of the
name is VARCHAR2.
property
value
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
15-23
Lesson
15: Adding Functionality to Items
......................................................................................................................................................
WHEN-NEW-FORM-INSTANCE
rg_emps :=
create_group_from_query(rg_emps
create_group_from_query(rg_emps,
select 1, level, last_name, NULL,
to_char(id) ||
from s_emp ||
connect by prior id= manager_id ||
start with title = President);
v_ignore := populate_group(rg_emps);
ftree.set_tree_property(block4.tree5,
set_tree_property
ftree.record_group, rg_emps);
Copyright Oracle Corporation, 2000. All rights reserved.
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.
......................................................................................................................................................
15-24
Oracle Forms Developer: Build Internet Applications I
ITEM;
NUMBER;
RECORDGROUP;
BEGIN
htree := Find_Item('tree_block.htree3');
rg_emps := Create_Group_From_Query('rg_emps',
select 1, level, ename, NULL, to_char(empno) ||
' from emp ' ||
'connect by prior empno = mgr ' ||
start with job = PRESIDENT);
v_ignore := Populate_Group(rg_emps);
Ftree.Set_Tree_Property(htree, Ftree.RECORD_GROUP, rg_emps);
END;
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
15-25
Lesson
15: Adding Functionality to Items
......................................................................................................................................................
Summary
......................................................................................................................................................
15-26
Oracle Forms Developer: Build Internet Applications I
Summary
......................................................................................................................................................
Summary
In this lesson, you learned to use triggers to provide functionality to the GUI items in
form applications.
The item interaction triggers accept SELECT statements and other
standard PL/SQL constructs.
There are built-ins for LOV control, list item control, image file reading,
sound item control, hierarchical tree, and so on.
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
15-27
Lesson
15: Adding Functionality to Items
......................................................................................................................................................
Practice 15 Overview
Note
For solutions to this practice, see Practice 15 in Appendix A, Practice Solutions.
......................................................................................................................................................
15-28
Oracle Forms Developer: Build Internet Applications I
Practice 15 Overview
......................................................................................................................................................
Practice 15 Overview
In this practice, you add some triggers that enable interaction with buttons. You also
create some additional functionality for a radio group.
Writing a trigger to check whether the customers 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.
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
15-29
Lesson
15: Adding Functionality to Items
......................................................................................................................................................
Practice 15
1 In the ORDGXX form write a trigger that fires when the payment type
......................................................................................................................................................
15-30
Oracle Forms Developer: Build Internet Applications I
16
................................
Runform Messages
and Alerts
Lesson
16: Runform Messages and Alerts
......................................................................................................................................................
Objectives
Schedule
Topic
Lecture
Practice
Total
Timing
60 minutes
20 minutes
80 minutes
......................................................................................................................................................
16-2
Oracle Forms Developer: Build Internet Applications I
Introduction
......................................................................................................................................................
Introduction
Overview
This lesson shows you how to intercept system messages, and if desired, replace them
with ones that are more suitable for your application. You will also learn how to
handle errors by using built-in subprograms, and how to build customized alerts for
communicating with users.
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
16-3
Lesson
16: Runform Messages and Alerts
......................................................................................................................................................
Messages
Informative
Error
Working
Application
......................................................................................................................................................
16-4
Oracle Forms Developer: Build Internet Applications I
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
16-5
Lesson
16: Runform Messages and Alerts
......................................................................................................................................................
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
......................................................................................................................................................
16-6
Oracle Forms Developer: Build Internet Applications I
If the GO_BLOCK built-in procedure fails because the S_INVENTORY block does
not exist, or because it is nonenterable, then the EXECUTE_QUERY procedure still
executes, and attempts a query in the wrong block.
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
Note: These built-in functions return success or failure of the latest action in the form.
The failing action may occur in a trigger that fired as a result of a built-in from the first
trigger. For example, the EXECUTE_QUERY procedure, can cause a Pre-Query
trigger to fire, which may itself fail.
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
16-7
Lesson
16: Runform Messages and Alerts
......................................................................................................................................................
......................................................................................................................................................
16-8
Oracle Forms Developer: Build Internet Applications I
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
16-9
Lesson
16: Runform Messages and Alerts
......................................................................................................................................................
All (default)
5
10
15
20
More critical
25
>25
Define by:
:SYSTEM.MESSAGE_LEVEL
Copyright Oracle Corporation, 2000. All rights reserved.
......................................................................................................................................................
16-10
Oracle Forms Developer: Build Internet Applications I
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, you can specify that only messages above a specified severity level are to
be issued by the form. You do this by assigning a value to the system variable
MESSAGE_LEVEL. Form Builder then only issues messages that are above the
severity level defined in this variable.
The default value for MESSAGE_LEVEL (at form startup) is 0. This means that
messages of all severities are displayed.
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
16-11
Lesson
16: Runform Messages and Alerts
......................................................................................................................................................
Suppressing Messages
:SYSTEM.MESSAGE_LEVEL := 5;
UP;
IF NOT FORM_SUCCESS THEN
MESSAGE(Already at the first Order);
END IF;
:SYSTEM.MESSAGE_LEVEL := 0;
:SYSTEM.SUPPRESS_WORKING
:SYSTEM.SUPPRESS_WORKING :=
:= TRUE;
TRUE;
......................................................................................................................................................
16-12
Oracle Forms Developer: Build Internet Applications I
Note: You can set these system variables as soon as the form starts up, if required, by
performing the assignments in a When-New-Form-Instance trigger.
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
16-13
Lesson
16: Runform Messages and Alerts
......................................................................................................................................................
FORM_TRIGGER_FAILURE
BEGIN
BEGIN
--RAISE
RAISE form_trigger_failure;
form_trigger_failure;
--EXCEPTION
EXCEPTION
--WHEN
WHEN <exception>
<exception> THEN
THEN
RAISE
RAISE form_trigger_failure;
form_trigger_failure;
--END;
Fail trigger
Copyright Oracle Corporation, 2000. All rights reserved.
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
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
16-15
Lesson
16: Runform Messages and Alerts
......................................................................................................................................................
Error Triggers
On-Error:
Fires when a system error message is issued
Is used to trap Form Builder and Oracle Server
errors, and to customize error messages
On-Message:
Fires when an informative system message is
issued
Is used to suppress or customize specific
messages
Instructor Note
Remind students that On triggers fire in place of the usual processing.
......................................................................................................................................................
16-16
Oracle Forms Developer: Build Internet Applications I
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
16-17
Lesson
16: Runform Messages and Alerts
......................................................................................................................................................
On-Message trigger
Built-in functions:
MESSAGE_CODE
MESSAGE_TEXT
MESSAGE_TYPE
......................................................................................................................................................
16-18
Oracle Forms Developer: Build Internet Applications I
On-Message Trigger
Use this trigger to suppress informative messages, replacing them with customized
application messages, as appropriate.
You can handle messages in On-Message in a similar way to On-Error. However,
because this trigger fires due to informative messages, you will use different built-ins
to determine the nature of the current message.
Built-in Function
MESSAGE_CODE
MESSAGE_TEXT
MESSAGE_TYPE
Note: These functions return information about the most recent message that was
issued. If your applications must be supported in more than one national language,
then use MESSAGE_CODE in preference to MESSAGE_TEXT when checking a
message.
Example of an On-Message Trigger
This On-Message trigger modifies the Query caused no records to be retrieved
message (40350).
IF MESSAGE_CODE = 40350 THEN
MESSAGE(No Orders found-check your search values);
ELSE
MESSAGE(MESSAGE_TYPE || - || TO_CHAR(MESSAGE_CODE) ||
: || MESSAGE_TEXT);
END IF;
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
16-19
Lesson
16: Runform Messages and Alerts
......................................................................................................................................................
Alert Properties
1
Alert Example
This is a generic example of an alert, showing all three icons and buttons that can be
defined.
1
Title
Message
Button1 label
Button2 label
Button3 label
Instructor Note
Create an alert that you can display in your application during a later demonstration.
You may want to define more than one button so that you can show the testing of user
response, as in the Delete Record example that follows.
......................................................................................................................................................
16-20
Oracle Forms Developer: Build Internet Applications I
Description
Name for this object
Alert title
Defines the symbol that accompanies message:
Stop, Caution, or Note
Labels for each of the three possible buttons (Null
indicates that the button is not required.)
Button 1, Button 2, or Button 3
Message that will appear in the alert
(maximum 200 characters)
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
16-21
Lesson
16: Runform Messages and Alerts
......................................................................................................................................................
Planning Alerts
Yes/No
questions
Yes/No/Cancel
questions
Caution
messages
Informative
messages
Instructor Note
When a form is deployed to the Web and the LookAndFeel parameter is set to
Oracle, the icons for the stop and note style alerts are different than they are in
client-server.
......................................................................................................................................................
16-22
Oracle Forms Developer: Build Internet Applications I
Lesson
16: Runform Messages and Alerts
......................................................................................................................................................
Controlling Alerts
SET_ALERT_PROPERTY
SET_ALERT_BUTTON_PROPERTY
......................................................................................................................................................
16-24
Oracle Forms Developer: Build Internet Applications I
Description
Alert_name
Property
Message
The character string that defines the message (You can give a character
expression instead of a simple quoted string, 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, button, property,
value)
Parameter
Description
Alert_name
Button
Property
Value
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
16-25
Lesson
16: Runform Messages and Alerts
......................................................................................................................................................
SHOW_ALERT Function
IF
IF
.. ..
SHOW_ALERT(del_Check)=ALERT_BUTTON1
SHOW_ALERT(del_Check)=ALERT_BUTTON1 THEN
THEN
..
Alert_Button1
Alert_Button2
Alert_Button3
Copyright Oracle Corporation, 2000. All rights reserved.
Instructor Note
Write a trigger that displays your earlier alert.
Demonstration Run the Show_Alert.fmb file that demonstrates creating a
generic alert.
1 Set title, message, and button labels to any value you want.
2 Click the Show the Alert button.
The button number that you clicked appears in the text item.
3 Show the underlying code in this form.
......................................................................................................................................................
16-26
Oracle Forms Developer: Build Internet Applications I
SHOW_ALERT Function
SHOW_ALERT is how you display an alert at run time, and return the operators
response to the calling trigger:
selected_button := SHOW_ALERT(alert_name);
. . .
Alert_Name is the name of the alert, as defined in the builder. You can alternatively
specify an Alert_Id (unquoted) for this argument.
SHOW_ALERT returns a NUMBER constant, that indicates which of the three
possible buttons the user pressed in response to the alert. These numbers correspond to
the values of three PL/SQL constants, which are predefined by the Form Builder:
If the number equals...
ALERT_BUTTON1
ALERT_BUTTON2
ALERT_BUTTON3
After displaying an alert that has more than one button, you can determine which
button the operator pressed by comparing the returned value against the corresponding
constants.
Example
A trigger that fires when the user attempts to delete a record might invoke the alert,
shown opposite, to obtain confirmation. If the operator selects Yes, then the
DELETE_RECORD built-in is called to delete the current record from the block.
IF SHOW_ALERT(del_check) = ALERT_BUTTON1 THEN
DELETE_RECORD;
END IF;
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
16-27
Lesson
16: Runform Messages and Alerts
......................................................................................................................................................
PROCEDURE Alert_On_Failure IS
n NUMBER;
BEGIN
SET_ALERT_PROPERTY(error_alert,
ALERT_MESSAGE_TEXT,ERROR_TYPE||
-||TO_CHAR(ERROR_CODE)||
: ||ERROR_TEXT);
n := SHOW_ALERT(error_alert);
END;
......................................................................................................................................................
16-28
Oracle Forms Developer: Build Internet Applications I
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
16-29
Lesson
16: Runform Messages and Alerts
......................................................................................................................................................
Summary
Summary
......................................................................................................................................................
16-30
Oracle Forms Developer: Build Internet Applications I
Summary
......................................................................................................................................................
Summary
In this lesson, you saw how to intercept system messages, and how to replace them
with ones that are more suitable for your application. You also learned how to build
customized alerts for communicating with operators.
The application and system messages appear on the Message line.
Test for failure of built-ins by using the FORM_SUCCESS built-in
function or other built-in functions.
Set system variables to suppress system messages:
- Assign a value to MESSAGE_LEVEL to specify that only messages
above a specific severity level are to be used by the form.
- Assign a value of True to SUPPRESS_WORKING to suppress all
working messages.
On-Error trigger intercepts system error messages.
On-Message trigger intercepts informative system messages.
Alert types: Stop, Caution, and Note.
Up to three buttons are available for operator response (NULL indicates
that the button is not required.).
Display alerts at run time with SHOW_ALERT.
Change alert messages with SET_ALERT_PROPERTY.
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
16-31
Lesson
16: Runform Messages and Alerts
......................................................................................................................................................
Practice 16 Overview
Note
For solutions to this practice, see Practice 16 in Appendix A, Practice Solutions.
......................................................................................................................................................
16-32
Oracle Forms Developer: Build Internet Applications I
Practice 16 Overview
......................................................................................................................................................
Practice 16 Overview
In this practice, 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.
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
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
16-33
Lesson
16: Runform Messages and Alerts
......................................................................................................................................................
Practice 16
1 Create an alert in ORDGXX called Payment_Type_Alert with a single
OK button. The message should read This customer must pay cash!
Suggested Title: Payment Type. 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.
Create a generic alert called Question_Alert that allows Yes and No
replies.
Leave the Message property blank for this alert. Select the Stop style, and define
two buttons in the alert: Yes and No.
Alter the When-Button-Pressed trigger on CONTROL.Exit_Button that
uses Question_Alert to ask the operator to confirm that the form should
terminate.
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, and call the EXIT_FORM built-in if
the operator replied Yes.
Save and compile the form. Deploy the form on the Web to test.
......................................................................................................................................................
16-34
Oracle Forms Developer: Build Internet Applications I
17
................................
Query Triggers
Lesson
17: Query Triggers
......................................................................................................................................................
Objectives
Schedule
Topic
Lecture
Practice
Total
Timing
60 minutes
30 minutes
90 minutes
......................................................................................................................................................
17-2
Oracle Forms Developer: Build Internet Applications I
Introduction
......................................................................................................................................................
Introduction
Overview
In this lesson, you learn how to control events associated with queries on base table
data blocks. You can customize the query process as necessary, and supplement the
results returned by a query.
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
17-3
Lesson
17: Query Triggers
......................................................................................................................................................
Query Processing
Fire
Fire Pre-Query
Pre-Query trigger
trigger
Construct
Construct SELECT...
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, 2000. All rights reserved.
......................................................................................................................................................
17-4
Oracle Forms Developer: Build Internet Applications I
Query Triggers
......................................................................................................................................................
Query Triggers
Generally, 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, if the Fire in Enter
Query Mode property of the associated trigger is enabled
The query triggers, Pre-Query and Post-Query, fire due to the query process itself, 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, or
possibly abandon a query before it is even executed, if the required conditions are not
suitable.
Form Builder Query Processing
When a query is initiated on a data block, either by the operator or by a built-in
subprogram, the following major events take place:
1 In Enter Query mode, Form Builder fires the Pre-Query trigger if
defined.
2 If the Pre-Query succeeds, Form Builder constructs the query SELECT
statement, based on any existing criteria in the block (either entered by
the operator or by the Pre-Query).
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.
5 The record is marked Valid.
6 Form Builder fires the Post-Query trigger. If it fails, this record is
flushed from the block.
7 Form Builder performs item and record validation if the record has
changed (due to a trigger).
8 Step 4 is repeated for any remaining records of this query.
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
17-5
Lesson
17: Query Triggers
......................................................................................................................................................
......................................................................................................................................................
17-6
Oracle Forms Developer: Build Internet Applications I
Note: The vertical bar ( | ) in the ORDER BY clause indicates that either of the two
possibilities can be present. Form Builder retrieves the ROWID only when the Key
Mode block property is set to Unique (the default). The entire WHERE clause is
optional. The ORDER BY clause is also optional.
If you want to count records that satisfy criteria specified in the Query/Where dialog
box, enter one or more variables and press Count Query in the Example Record.
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
17-7
Lesson
17: Query Triggers
......................................................................................................................................................
WHERE Clause
ORDER BY Clause
......................................................................................................................................................
17-8
Oracle Forms Developer: Build Internet Applications I
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
17-9
Lesson
17: Query Triggers
......................................................................................................................................................
Pre-Query Trigger
IF
TO_CHAR(:S_ORD.DATE_SHIPPED)
IS NULL THEN
MESSAGE(You must query by
Order ID or Date);
RAISE form_trigger_failure;
END IF;
Instructor Note
With a restricted query, this trigger code can cause an error. For example, entering >10
for the ID item causes an error because the TO_CHAR in the trigger code around the
ID item. Using NAME_IN in the code ensures that the correct datatype is used.
......................................................................................................................................................
17-10
Oracle Forms Developer: Build Internet Applications I
Note: Pre-Query is useful for assigning values passed from other Oracle Forms
Developer modules, so that the query is related to data elsewhere in the session. We
will look at doing this later.
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
17-11
Lesson
17: Query Triggers
......................................................................................................................................................
Post-Query Trigger
SELECT
COUNT(ord_id)
INTO
:S_ORD.lineitem_count
FROM
WHERE
S_ITEM
ord_id = :S_ORD.id;
......................................................................................................................................................
17-12
Oracle Forms Developer: Build Internet Applications I
Post-Query Trigger
This trigger is defined at block level or above. Post-Query fires for each record that is
fetched into the block as a result of a query. Note that the trigger fires only on the
initial fetch of a record, not when a record is subsequently scrolled back into view a
second or third time.
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, and displays this number as a summary value in the nonbase table
item :Lineitem_count.
SELECT COUNT(ord_id)
INTO :S_ORD.lineitem_count
FROM S_ITEM
WHERE ord_id = :S_ORD.id;
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
17-13
Lesson
17: Query Triggers
......................................................................................................................................................
......................................................................................................................................................
17-14
Oracle Forms Developer: Build Internet Applications I
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
17-15
Lesson
17: Query Triggers
......................................................................................................................................................
Coding for
ENTER-QUERY Mode
Instructor Note
The following triggers may fire in Enter Query mode:
Key On-Error
On-Message
When- triggers, except:
- When-Database-Record
- When-Image-Activated
- When-New-Block-Instance
- When-New-Form-Instance
- When-Create-Record
- When-Remove-Record
- When-Validate-Record
- When-Validate-Item
To create a trigger that fires in Enter Query mode:
1 In the Object Navigator, select a trigger.
2 In the Property Palette, set the Fire in Enter Query Mode property to Yes.
......................................................................................................................................................
17-16
Oracle Forms Developer: Build Internet Applications I
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
17-17
Lesson
17: Query Triggers
......................................................................................................................................................
Coding for
ENTER-QUERY Mode
Example
IF
:SYSTEM.MODE = NORMAL
THEN ENTER_QUERY;
ELSE EXECUTE_QUERY;
END IF;
......................................................................................................................................................
17-18
Oracle Forms Developer: Build Internet Applications I
Lesson
17: Query Triggers
......................................................................................................................................................
Do-the-Right-Thing Built-in
On-Close
On-Count
COUNT_QUERY
On-Fetch
FETCH_RECORDS
Pre-Select
On-Select
SELECT_RECORDS
Post-Select
......................................................................................................................................................
17-20
Oracle Forms Developer: Build Internet Applications I
Do-the-Right-Thing Built-in
COUNT_QUERY
FETCH_RECORDS
SELECT_RECORDS
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
17-21
Lesson
17: Query Triggers
......................................................................................................................................................
Instructor Note
When the CREATE_QUERIED_RECORD built-in is called from an On-Fetch trigger,
it creates a record on the block waiting list. The waiting list is an intermediary record
buffer that contains records that have been fetched from the data source, but have not
yet been placed on the block list of active records. This built-in is included primarily
for applications using transactional triggers to run against a data source other than
Oracle.
......................................................................................................................................................
17-22
Oracle Forms Developer: Build Internet Applications I
On-Fetch
Characteristic
Fires when Form Builder closes a query (It augments, rather than
replaces, default processing.)
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.) The trigger
continues to fire until:
Pre-Select
On-Select
Post-Select
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
17-23
Lesson
17: Query Triggers
......................................................................................................................................................
SYSTEM.MODE
SYSTEM.LAST_QUERY
Contains bind variables (ORD_ID = :1) before
SELECT_RECORDS
Contains actual values (ORD_ID = 102) after
SELECT_RECORDS
......................................................................................................................................................
17-24
Oracle Forms Developer: Build Internet Applications I
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
17-25
Lesson
17: Query Triggers
......................................................................................................................................................
GET_BLOCK_PROPERTY
SET_BLOCK_PROPERTY
Get and set:
DEFAULT_WHERE
ORDER_BY
QUERY_ALLOWED
QUERY_HITS
Get only:
QUERY_OPTIONS
RECORDS_TO_FETCH
GET_ITEM_PROPERTY
SET_ITEM_PROPERTY
Get and set:
CASE_INSENSITIVE_QUERY
QUERYABLE
QUERY_ONLY
Get only:
QUERY_LENGTH
......................................................................................................................................................
17-26
Oracle Forms Developer: Build Internet Applications I
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
17-27
Lesson
17: Query Triggers
......................................................................................................................................................
Summary
Summary
......................................................................................................................................................
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
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
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
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
Item level
Validation
......................................................................................................................................................
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 items 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
Lesson
18: Validation
......................................................................................................................................................
Instructor Note
Show the Validation Unit property in Form Builder. You may want to set Validation
Unit to a higher level, and demonstrate its effect at run time.
......................................................................................................................................................
18-6
Oracle Forms Developer: Build Internet Applications I
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
18-7
Lesson
18: Validation
......................................................................................................................................................
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, 2000. All rights reserved.
Instructor Note
Set the Validate from List property on an item to which you have already attached a
suitable LOV. Then, build and run the form to show the use of this feature.
......................................................................................................................................................
18-8
Oracle Forms Developer: Build Internet Applications I
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
18-9
Lesson
18: Validation
......................................................................................................................................................
Validation Triggers
Item level
When-Validate-Item
Block level
When-Validate-Record
IF
IF :S_ORD.date_shipped
:S_ORD.date_shipped << :S_ORD.date_ordered
:S_ORD.date_ordered THEN
THEN
MESSAGE(Ship
MESSAGE(Ship Date
Date is
is before
before Order
Order Date!);
Date!);
RAISE
RAISE form_trigger_failure;
form_trigger_failure;
END
IF;
END IF;
Instructor Note
Introduce When-Validate-Record as an additional validation trigger.
Students who have experience with early versions of the product (SQL*Forms V2.3)
sometimes ask about using Post-Change as a validation trigger.
Post-Change does not fire if an item is set to Null, and it can fire on population at
query time, making it less specific to validation than the When-Validate-Object
triggers.
The Post-Change trigger is included only for compatibility with previous versions of
Form Builder. Its use is not recommended in new applications.
......................................................................................................................................................
18-10
Oracle Forms Developer: Build Internet Applications I
When-Validate-Record Trigger
This trigger fires after standard record-level validation, when the operator has left a
new or changed record. Because Form Builder has already checked that required items
for the record are valid, you can use this trigger to perform additional checks that may
involve more than one of the records items, in the order they were entered.
When-Validate-Record must be defined at block level or above.
Example
This When-Validate-Record trigger on block S_ORD ensures that orders cannot be
shipped before they are ordered.
IF :S_ORD.date_shipped < :S_ORD.date_ordered THEN
MESSAGE(Ship Date is before Order Date!);
RAISE form_trigger_failure;
END IF;
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
18-11
Lesson
18: Validation
......................................................................................................................................................
SELECT . . .
WHERE id = :S_ORD.customer_id
Trigger failure?
Copyright Oracle Corporation, 2000. All rights reserved.
......................................................................................................................................................
18-12
Oracle Forms Developer: Build Internet Applications I
If the Customer_ID item contains a value that is not found in the table, the
NO_DATA_FOUND exception is raised, and the trigger will fail because there is no
exception handler to prevent the exception from propagating to the end of the trigger.
Note: A failing When-Validate-Item trigger prevents the cursor from leaving the item.
For an unhandled exception, as above, the user receives the message:
FRM-40735: <trigger type> trigger raised unhandled exception
<exception>
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
18-13
Lesson
18: Validation
......................................................................................................................................................
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
VALID
When validation has been successful
After records are fetched from database
After a successful post or commit
Duplicated record inherits status of source
......................................................................................................................................................
18-14
Oracle Forms Developer: Build Internet Applications I
Definition
NEW
When a record is created, Form Builder marks every item in that record as
new. 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.
CHANGED
VALID
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
Definition
NEW
When a record is created, Form Builder marks that record as new. 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.
CHANGED
VALID
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
18-15
Lesson
18: Validation
......................................................................................................................................................
......................................................................................................................................................
18-16
Oracle Forms Developer: Build Internet Applications I
You can also use this built-in to change the validation unit programmatically:
SET_FORM_PROPERTY(form_name,VALIDATION_UNIT, scope);
VALIDATE
VALIDATE forces Form Builder to immediately execute validation processing for the
indicated scope.
Note: Scope is one of DEFAULT_SCOPE, BLOCK_SCOPE, RECORD_SCOPE, or
ITEM_SCOPE.
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
18-17
Lesson
18: Validation
......................................................................................................................................................
Summary
Summary
......................................................................................................................................................
18-18
Oracle Forms Developer: Build Internet Applications I
Summary
......................................................................................................................................................
Summary
In this lesson, you learned to use additional validation features in Form Builder, and to
control when validation occurs.
Validation occurs at three levels:
- Item level: To ensure that the value conforms to the items properties
- Record level: To ensure that the record is valid (If it is not, then the
status of each item in the record is checked.)
- Block and form level: To ensure that the all records below the level
are validated.
Validation happens when:
- The [Enter] Key is pressed or the ENTER built-in procedure is run
(to force validation immediately.)
- Control leaves the validation unit due to navigation or Commit.
Standard validation occurs before trigger validation.
The Default validation unit is item level.
Validation Status:
- NEW
- CHANGED
- VALID
The When-Validate-object triggers supplement standard validation.
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
18-19
Lesson
18: Validation
......................................................................................................................................................
Practice 18 Overview
Note
For solutions to this practice, see Practice 18 in Appendix A, Practice Solutions.
......................................................................................................................................................
18-20
Oracle Forms Developer: Build Internet Applications I
Lesson
18: Validation
......................................................................................................................................................
Practice 18
1
......................................................................................................................................................
18-22
Oracle Forms Developer: Build Internet Applications I
Lesson
19: Navigation
......................................................................................................................................................
Objectives
Schedule
Topic
Lecture
Practice
Total
Timing
45 minutes
20 minutes
65 minutes
......................................................................................................................................................
19-2
Oracle Forms Developer: Build Internet Applications I
Lesson
19: Navigation
......................................................................................................................................................
Objectives
Schedule
Topic
Lecture
Practice
Total
Timing
45 minutes
20 minutes
65 minutes
......................................................................................................................................................
19-2
Oracle Forms Developer: Build Internet Applications I
Introduction
......................................................................................................................................................
Introduction
Overview
Form Builder offers a variety of ways to control cursor movement. This lesson looks at
the different methods of forcing navigation both visibly and invisibly.
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
19-3
Lesson
19: Navigation
......................................................................................................................................................
About Navigation
......................................................................................................................................................
19-4
Oracle Forms Developer: Build Internet Applications I
About Navigation
......................................................................................................................................................
About Navigation
The following sections introduce a number of navigational concepts to help you to
understand the navigation process.
What Is the Navigational Unit?
The navigational unit is an invisible, internal object that determines the navigational
state of a form. Form Builder uses the navigation unit to keep track of the object that is
currently the focus of a navigational process. 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.
Entering and Leaving Objects
During navigation, Form Builder leaves and enters objects. Entering an object means
changing the navigation unit from the object above in the hierarchy. Leaving an object
means changing the navigation unit to the object above.
The Cursor and How It Relates to the Navigation Unit
The cursor is a visible, external object that indicates the current input focus. Form
Builder will not move the cursor until the navigation unit has successfully become the
target item. In this sense, the navigation unit acts as a probe.
What Happens If Navigation Fails?
If navigation fails, Form Builder reverses the navigation path and attempts to move the
navigation unit back to its initial location. Note that the cursor is still at its initial
position. If Form Builder cannot move the navigation unit back to its initial location, it
exits the form.
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
19-5
Lesson
19: Navigation
......................................................................................................................................................
Navigation Properties
Form module
Mouse navigation limit
First navigation data block
Block
Navigation style
Previous navigation data block
Next navigation data block
Navigation Properties
Item
Enabled
Keyboard navigable
Mouse navigate
Previous navigation item
Next navigation item
......................................................................................................................................................
19-6
Oracle Forms Developer: Build Internet Applications I
Controlling Navigation
......................................................................................................................................................
Controlling Navigation
You can control the path through an application by controlling the order in which the
user navigates to objects. You have seen navigation properties for blocks and items.
There are two other navigation properties that you can set for the form module: Mouse
Navigation Limit and First Navigation Block.
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.)
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.
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
19-7
Lesson
19: Navigation
......................................................................................................................................................
Exit record
^
x
Exit block
v
Enter block
Enter record
Enter item
Copyright Oracle Corporation, 2000. All rights reserved.
Instructor Note
Point out that with Mouse Navigate set to No, none of the navigation events listed in
the above slide occur.
......................................................................................................................................................
19-8
Oracle Forms Developer: Build Internet Applications I
Controlling Navigation
......................................................................................................................................................
Note: The default setting for the Mouse Navigate property is Yes.
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
19-9
Lesson
19: Navigation
......................................................................................................................................................
Internal Navigation
Exit item
^
x
Next Record
Exit record
v
Enter record
Enter item
Instructor Note
Draw navigation examples of on entry and on commit.
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
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
19-11
Lesson
19: Navigation
......................................................................................................................................................
Navigation Triggers
^
x
When-New-object-Instance
Navigation Triggers
Pre- and Post-
When-New-object-Instance
......................................................................................................................................................
19-12
Oracle Forms Developer: Build Internet Applications I
Navigation Triggers
......................................................................................................................................................
Navigation Triggers
The navigation triggers can be subdivided into two general groups:
Pre- and Post- navigation triggers
When-New-object-Instance triggers
When Do Pre- and Post-Navigation Triggers Fire?
The Pre- and Post- navigation triggers fire during navigation, that is just before entry
to or just after exit from the object specified as part of the trigger name.
Example
The Pre-Text-Item trigger fires just before entering a text item.
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.
Example
The When-New-Item-Instance trigger fires immediately after navigation to a new
instance of an item.
When Do Navigation Triggers Not Fire?
The Pre- and Post-navigation triggers do not fire if they belong to a unit that is lower
in the hierarchy than the current validation unit. For instance, if the validation unit is
Record, Pre- and Post-Text-Item triggers do not fire.
What Happens When a Navigation Trigger Fails?
If a Pre- or Post-navigation trigger fails, the input focus returns to its initial location
(where it was prior to the trigger firing). To the user, it appears that the input focus has
not moved at all.
Note: Be sure that Pre- and Post-navigation triggers display a message on failure.
Failure of a navigation trigger can cause a fatal error to your form. For example,
failure of Pre-Form, Pre-Block, Pre-Record, or Pre-Text-Item on entry to the form will
cancel execution of the form.
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
19-13
Lesson
19: Navigation
......................................................................................................................................................
When-New-object-Instance Triggers
When-New-Form-Instance
When-New-Block-Instance
When-New-Record-Instance
When-New-Item-Instance
SET_object_PROPERTY Examples
SET_FORM_PROPERTY(FIRST_NAVIGATION_BLOCK,
SET_FORM_PROPERTY(FIRST_NAVIGATION_BLOCK,
S_ITEM);
S_ITEM);
SET_BLOCK_PROPERTY(S_ORD, ORDER_BY,
CUSTOMER_ID);
SET_RECORD_PROPERTY(3,
SET_RECORD_PROPERTY(3, S_ITEM,
S_ITEM, STATUS,
STATUS,
QUERY_STATUS);
QUERY_STATUS);
SET_ITEM_PROPERTY(CONTROL.stock_button,
SET_ITEM_PROPERTY(CONTROL.stock_button,
ICON_NAME,
ICON_NAME, stock);
stock);
Copyright Oracle Corporation, 2000. All rights reserved.
......................................................................................................................................................
19-14
Oracle Forms Developer: Build Internet Applications I
Fires
Whenever Form Builder runs a form, 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
Example
Perform a query of all orders, when the ORDERS form is run, by including the
following code in your When-New-Form-Instance trigger:
EXECUTE_QUERY;
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
19-15
Lesson
19: Navigation
......................................................................................................................................................
Pre/Post-Form
Pre/Post-Block
Pre/Post-Record
Pre/Post-Text-Item
Instructor Note
Ask the students what type of trigger you would use reenable the Stock_Button.
......................................................................................................................................................
19-16
Oracle Forms Developer: Build Internet Applications I
Lesson
19: Navigation
......................................................................................................................................................
^
A
Post-Text-Item
Pre-Text-Item
v
Pre-Text-Item
Instructor Note
Demonstration The navigation.fmb file contains navigation triggers defined
at the form level. Run the file, click the Display Messages check box, and navigate
through the form. As each navigation trigger fires, a message displays. Use this
demonstration to explain navigation triggers and the potential navigation trap.
......................................................................................................................................................
19-18
Oracle Forms Developer: Build Internet Applications I
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
19-19
Lesson
19: Navigation
......................................................................................................................................................
Navigation in Triggers
When-New-Item-Instance
IF CHECKBOX_CHECKED(S_ORD.order_filled)THEN
SET_ITEM_PROPERTY(S_ORD.date_shipped,
UPDATE_ALLOWED, property_false);
GO_ITEM(S_ORD.date_shipped);
END IF;
Pre-Text-Item
IF
IF CHECKBOX_CHECKED(S_ORD.order_filled)
CHECKBOX_CHECKED(S_ORD.order_filled) THEN
THEN
SET_ITEM_PROPERTY(S_ORD.date_shipped,
SET_ITEM_PROPERTY(S_ORD.date_shipped,
UPDATE_ALLOWED,
UPDATE_ALLOWED, property_false);
property_false);
GO_ITEM(S_ORD.date_shipped);
END
END IF;
IF;
Copyright Oracle Corporation, 2000. All rights reserved.
Instructor Note
Point out that the first example correctly uses the When-New-Item-Instance trigger,
whereas the second incorrectly uses the Pre-Text-Item trigger and contains a restricted
built-in.
......................................................................................................................................................
19-20
Oracle Forms Developer: Build Internet Applications I
Navigation in Triggers
......................................................................................................................................................
Navigation in Triggers
You can initiate navigation programmatically by calling the built-in subprograms, such
as GO_ITEM and PREVIOUS_BLOCK from triggers.
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
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
19-21
Lesson
19: Navigation
......................................................................................................................................................
Summary
Navigation trap
Navigation in triggers
......................................................................................................................................................
19-22
Oracle Forms Developer: Build Internet Applications I
Summary
......................................................................................................................................................
Summary
In this lesson, you learned at the different methods of forcing visible navigation and
also the invisible events.
You can control navigation through the following properties:
- Form module properties
- Data block properties
- Item properties
Internal navigation events also occur.
Navigation triggers:
- When-New-object-Instance
- Pre- and Post Avoid the navigation trap.
Navigation built-ins are available.
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
19-23
Lesson
19: Navigation
......................................................................................................................................................
Practice 19 Overview
Note
For solutions to this practice, see Practice 19 in Appendix A, Practice Solutions.
......................................................................................................................................................
19-24
Oracle Forms Developer: Build Internet Applications I
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.
Also, you provide a trigger to automatically perform query at form startup.
Executing a query at form startup
Populating product images when the cursor arrives on each record of the
S_ITEM block
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
19-25
Lesson
19: Navigation
......................................................................................................................................................
Practice 19
1 Write a When-New-Form-Instance trigger on the ORDGXX form to
If the function returns a usable filename, your trigger should pass this name to the
READ_IMAGE_FILE built-in.
3 Define the same trigger type and code on the S_ORD block.
This will display the image for the first line items product if the operator changes
the displayed order.
4 Is there another trigger where you might also want to place this code?
5 Save and compile the form. Deploy the form on the Web to test.
......................................................................................................................................................
19-26
Oracle Forms Developer: Build Internet Applications I
20
................................
Transaction Processing
Lesson
20: Transaction Processing
......................................................................................................................................................
Objectives
Schedule
Topic
Lecture
Practice
Total
Timing
90 minutes
30 minutes
120 minutes
......................................................................................................................................................
20-2
Oracle Forms Developer: Build Internet Applications I
Introduction
......................................................................................................................................................
Introduction
Overview
While applying a users changes to the database, Form Builder enables you to make
triggers fire in order to alter or add to the default behavior. This lesson shows you how
to build triggers that can perform additional tasks during this stage of a transaction.
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
20-3
Lesson
20: Transaction Processing
......................................................................................................................................................
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;
work;
......................................................................................................................................................
20-4
Oracle Forms Developer: Build Internet Applications I
Transaction Processing
......................................................................................................................................................
Transaction Processing
When Form Builder is asked to save the changes made in a form by the user, a process
takes place involving events in the current database transaction. This process includes:
Default Form Builder transaction processing: Applies the users 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, Form Builder commits the
transaction, making the changes permanent.
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, or
clicks on the Save button on the default Form toolbar.
The COMMIT_FORM built-in procedure is called from a trigger.
In either case, the process involves two phases, posting and committing.
Post Posting writes the users changes to the base tables, using implicit INSERT,
UPDATE, and DELETE statements generated by Form Builder. The changes are
applied in block sequence order as they appear in the Object Navigator at design time.
For each block, deletes are performed first, followed by inserts and updates.
Transactional triggers fire during this cycle if defined by the designer.
The built-in procedure POST alone can invoke this posting process.
Commit This performs the database commit, making the applied changes permanent
and releasing locks.
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
20-5
Lesson
20: Transaction Processing
......................................................................................................................................................
Transaction Processing
Post:
Writes record changes to base tables
Fires transactional triggers
......................................................................................................................................................
20-6
Oracle Forms Developer: Build Internet Applications I
Transaction Processing
......................................................................................................................................................
Rollbacks
Form Builder will roll back applied changes to a savepoint if an error occurs in its
default processing, or when a transactional trigger fails.
By default, the user is informed of the error through a message, and a failing insert or
update results in the record being redisplayed. The user can then attempt to correct the
error before trying to save again.
Savepoints
Form Builder issues savepoints in a transaction automatically, and will roll back to the
latest savepoint if certain events occur. Generally, these savepoints are for Form
Builder internal use, but certain built-ins, such as the EXIT_FORM built-in procedure,
can request a rollback to the latest savepoint by using the TO_SAVEPOINT option.
Locking
When you update or delete base table records in a form application, database locks are
automatically applied. Locks also apply during the posting phase of a transaction, and
for DML statements that you explicitly use in your code.
Note: The SQL statements COMMIT, ROLLBACK, and SAVEPOINT cannot be
called from a trigger directly. If encountered in a client-side program unit, Form
Builder treats COMMIT as the COMMIT_FORM built-in, and ROLLBACK as the
CLEAR_FORM built-in.
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
20-7
Lesson
20: Transaction Processing
......................................................................................................................................................
......................................................................................................................................................
20-8
Oracle Forms Developer: Build Internet Applications I
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
20-9
Lesson
20: Transaction Processing
......................................................................................................................................................
Characteristics of
Commit Triggers
Characteristics of
Commit Triggers
......................................................................................................................................................
20-10
Oracle Forms Developer: Build Internet Applications I
On-DML
Post-Forms-Commit
Post-Database-Commit
Characteristic
Fires once during commit processing, before base table
blocks are processed; 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, even if there are no changes to post.)
Fire for each record that is marked for insert, update, or
delete, just before or after the row is inserted, updated, or
deleted in the database
Fires for each record that is marked for insert, update, or
delete when Forms would typically issue its INSERT,
UPDATE, or DELETE statement (These triggers replace the
DML statements. Include a call to the INSERT_RECORD,
UPDATE_RECORD, or DELETE_RECORD built-in to
perform the default processing for these triggers.)
Fires once during commit processing, after base table blocks
are processed but before the SQL-COMMIT statement is
issued; even fires if there are no changes to post or commit.
Fires once during commit processing, after the
SQL-COMMIT statement is issued; even fires if there are no
changes to commit (This is also true for the SQL-COMMIT
statement itself.)
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
20-11
Lesson
20: Transaction Processing
......................................................................................................................................................
Pre-Commit
Pre-Delete
Pre-Insert
Pre-Update
On-Insert/Update/Delete
Post-Forms-Commit
Post-Database-Commit
......................................................................................................................................................
20-12
Oracle Forms Developer: Build Internet Applications I
Lesson
20: Transaction Processing
......................................................................................................................................................
Life of an Update
Query
Item
20
30
20
[Save]
30
20
Pre-Update
30
20
Row Updated
updated
30
30
20
Post-Update
30
30
20
Commit
30
30
......................................................................................................................................................
20-14
Oracle Forms Developer: Build Internet Applications I
Lesson
20: Transaction Processing
......................................................................................................................................................
Delete Validation
Pre-Delete trigger
Final checks before row deletion
DECLARE
CURSOR C1 IS
SELECT anything FROM S_ORD
WHERE customer_id = :S_CUSTOMER.id;
BEGIN
OPEN C1;
FETCH C1 INTO :GLOBAL.dummy;
IF C1%FOUND THEN
CLOSE C1;
MESSAGE(There are orders for this customer!);
RAISE form_trigger_failure;
ELSE
CLOSE C1;
END IF;
END;
Copyright Oracle Corporation, 2000. All rights reserved.
Instructor Note
In the example above, a local PL/SQL variable could be used rather than a global
variable. When the block terminates, a PL/SQL variable ceases to exist. A global
variable exists for the session.
......................................................................................................................................................
20-16
Oracle Forms Developer: Build Internet Applications I
Lesson
20: Transaction Processing
......................................................................................................................................................
S_ORD_ID.nextval
S_ORD_ID.nextval
:S_ORD.id
:S_ORD.id
SYS.dual;
SYS.dual;
Insert
Pre-Insert
ID
601
6
60
Value Value
01
Database
602
Sequence
Copyright Oracle Corporation, 2000. All rights reserved.
Instructor Note
Demonstration In the demonstration form that you are building:
Create the Pre-Insert trigger, shown above, in the S_ORD block.
Generate and run to show effects, noting that the assigned sequence
number appears when the new record is saved.
......................................................................................................................................................
20-18
Oracle Forms Developer: Build Internet Applications I
Lesson
20: Transaction Processing
......................................................................................................................................................
Post-Insert example:
:GLOBAL.insert_tot
:GLOBAL.insert_tot :=
:=
TO_CHAR(TO_NUMBER(:GLOBAL.insert_tot)+1);
TO_CHAR(TO_NUMBER(:GLOBAL.insert_tot)+1);
......................................................................................................................................................
20-20
Oracle Forms Developer: Build Internet Applications I
Example
This Post-Insert trigger adds to a running total of Inserts for the transaction, which is
recorded in the global variable INSERT_TOT.
:GLOBAL.insert_tot := TO_CHAR(TO_NUMBER(:GLOBAL.insert_tot)+1);
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
20-21
Lesson
20: Transaction Processing
......................................................................................................................................................
SQL%FOUND
SQL%NOTFOUND
SQL%ROWCOUNT
UPDATE S_ORD
SET date_shipped = SYSDATE
WHERE id = :S_ORD.id;
IF SQL%NOTFOUND THEN
MESSAGE(Record not found in database);
RAISE form_trigger_failure;
END IF;
Copyright Oracle Corporation, 2000. All rights reserved.
......................................................................................................................................................
20-22
Oracle Forms Developer: Build Internet Applications I
Lesson
20: Transaction Processing
......................................................................................................................................................
UPDATE
SET
WHERE
(base_column, base_column,...)
(:base_item, :base_item, ...)
base_table
base_column = :base_item, base_column =
:base_item, ...
ROWID = :ROWID
DELETE
FROM base_table
WHERE
ROWID = :ROWID
......................................................................................................................................................
20-24
Oracle Forms Developer: Build Internet Applications I
Lesson
20: Transaction Processing
......................................................................................................................................................
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
Instructor Note
The above transactional triggers are meant to be used when connecting to
data sources other than Oracle.
......................................................................................................................................................
20-26
Oracle Forms Developer: Build Internet Applications I
Do-the-Right-Thing Built-in
CHECK_RECORD_UNIQUENESS
ENFORCE_COLUMN_SECURITY
COMMIT_FORM
ISSUE_ROLLBACK
ISSUE_SAVEPOINT
GENERATE_SEQUENCE_NUMBER
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
20-27
Lesson
20: Transaction Processing
......................................................................................................................................................
Do-the-Right-Thing Built-in
Pre-Logon
Pre-Logout
On-Logon
LOGON
On-Logout
LOGOUT
Post-Logon
Post-Logout
Instructor Note
There are more transactional triggers, but those covered on this and the previous slides
are the most important.
......................................................................................................................................................
20-28
Oracle Forms Developer: Build Internet Applications I
Do-the-Right-Thing Built-in
LOGON
LOGOUT
-
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
20-29
Lesson
20: Transaction Processing
......................................................................................................................................................
......................................................................................................................................................
20-30
Oracle Forms Developer: Build Internet Applications I
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
20-31
Lesson
20: Transaction Processing
......................................................................................................................................................
......................................................................................................................................................
20-32
Oracle Forms Developer: Build Internet Applications I
INSERT
QUERY
CHANGED
Description
Indicates that the record has been created, but that none of its items
have been changed yet (The record may have been populated by
default values.)
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; see
below. Note that when you change a control item of a NEW record,
the record status also becomes INSERT.)
Indicates that the record corresponds to a row in the database, 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
Lesson
20: Transaction Processing
......................................................................................................................................................
SYSTEM.BLOCK_STATUS:
NEW (may contain records with status
INSERT)
QUERY (also possible for control block)
CHANGED (block will be committed)
SYSTEM.FORM_STATUS:
NEW
QUERY
CHANGED
......................................................................................................................................................
20-34
Oracle Forms Developer: Build Internet Applications I
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).
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.)
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. Note that a control block cannot have the status 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
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
20-35
Lesson
20: Transaction Processing
......................................................................................................................................................
Warnings:
Do not confuse commit status with validation
status.
The commit status is updated during
validation.
......................................................................................................................................................
20-36
Oracle Forms Developer: Build Internet Applications I
Description
Use the STATUS property to obtain the block status of
the specified block.
Use the STATUS property to obtain the record status of
the specified record in the specified block.
Set the STATUS property of the specified record in the
specified block to one of the following constants:
NEW_STATUS, INSERT_STATUS
QUERY_STATUS
CHANGED_STATUS
Example
If the third record of the S_ORD block is a changed database record, set the status
back to QUERY.
BEGIN
IF GET_RECORD_PROPERTY(3, S_ORD,status)= CHANGED THEN
SET_RECORD_PROPERTY(3, S_ORD, status, query_status);
END IF;
END;
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
20-37
Lesson
20: Transaction Processing
......................................................................................................................................................
Array DML
Empno Ename
Job
Hiredate
1234
Database
PREFires
DML
DML
POST-
POSTFires
......................................................................................................................................................
20-38
Oracle Forms Developer: Build Internet Applications I
Array Processing
......................................................................................................................................................
Array Processing
Overview
Array processing is an option in Form Builder that alters the way records are
processed. The default behavior of Form Builder is to process records one at a time.
By enabling array processing, you can process groups of records at a time, reducing
network traffic and thereby increasing performance. With array processing, a structure
(an array) containing multiple records is sent to or returned from the server for
processing.
Form Builder supports both array fetch processing and array DML processing. For
both querying and DML operations, you can determine the array size to optimize
performance for your needs. This lesson focuses on array DML processing.
Array processing is available for query and DML operations for blocks based on
tables, views, procedures, and subqueries; it is not supported for blocks based on
transactional triggers.
Effect of Array DML on Transactional Triggers
With DML Array Size set to 1, the Pre-Insert, Pre-Update, and Pre-Delete triggers fire
for each new, changed, and deleted record; the DML is issued, and the Post- trigger for
that record fires.
With DML Array Size set to greater than 1, the appropriate Pre- triggers fire for all of
the new, changed, and deleted rows; all of the DML statements are issued, and all of
the Post- triggers fire.
If you change 100 rows and DML Array Size is 20, you get 100 Pre- triggers, 5 arrays
of 20 DML statements, and 100 Post- triggers.
Instructor Note
Some students may ask why DML Array Size is not always set to a very large number.
There is a point of diminishing return. If each record is very large, a large array size
might result in records being broken into multiple packets.
If you write On-DML triggers, you overwrite default transaction processing and
cancel array processing.
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
20-39
Lesson
20: Transaction Processing
......................................................................................................................................................
......................................................................................................................................................
20-40
Oracle Forms Developer: Build Internet Applications I
Array Processing
......................................................................................................................................................
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
20-41
Lesson
20: Transaction Processing
......................................................................................................................................................
Summary
......................................................................................................................................................
20-42
Oracle Forms Developer: Build Internet Applications I
Summary
......................................................................................................................................................
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:
- Post: Applies form changes to the base tables and fires transactional
triggers
- Commit: Commits the database transaction
Flow of commit processing
DML statements issued during commit processing:
- Based on base table items
- UPDATE and DELETE statements use ROWID by default
Characteristics of commit triggers:
- The Pre-Commit, Post-Forms-Commit, and Post-Database-Commit
triggers fire once per commit process, but consider uncommitted
changes or posts.
- The Pre-, On-, and Post-Insert, Update, and Delete triggers fire once
per processed record.
Common uses for commit triggers: check authorization, set up special
locking requirements, generate sequence numbers, check complex
constraints, replace default DML statements issued by Form Builder.
Overriding default transaction processing:
- Transactional On-Event triggers and Do-the-Right-Thing built-ins
- Data sources other than Oracle use Open Gateway, ODBC, or
transactional triggers
Getting and setting the commit status:
- System variables
- Built-ins
Array DML
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
20-43
Lesson
20: Transaction Processing
......................................................................................................................................................
Practice 20 Overview
Note
For solutions to this practice, see Practice 20 in Appendix A, Practice Solutions.
......................................................................................................................................................
20-44
Oracle Forms Developer: Build Internet Applications I
Practice 20 Overview
......................................................................................................................................................
Practice 20 Overview
In this practice, you add transactional triggers to the ORDGXX form to automatically
provide sequence numbers to records at save time. You also customize commit
messages and the login screen in the CUSTGXX form.
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
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
20-45
Lesson
20: Transaction Processing
......................................................................................................................................................
Practice 20
1 In the ORDGXX form, write a transactional trigger on the S_ORD block
2
3
4
that populates S_ORD.Id with the next value from the S_ORD_ID
sequence.
Create a Pre-Insert trigger that assigns a value from this sequence. If an exception
occurs in the trigger, fail the trigger with a message.
In the S_ORD block, set the Enabled property of the ID item to No.
Save, compile, and run the form to test.
Insert a new order. The unique ID for the order should appear when you save it.
Create a similar trigger on the S_ITEM block that assigns the Item_Id
when a new record is saved.
Derive this number by adding to the current highest Item_Id for the order. Perform
the action in a Pre-Insert trigger. Set the Required and Enabled properties to No for
Item_Id.
Save and compile the form. Deploy the form on the Web to test.
Insert a new line-item record in the S_ITEM block, then save it.
Instructor Note
Solution 20:4 is not the safest way. The better solution is to keep the total number of
rows in another table that you can lock, but this solution is too advanced at this stage.
6 Open the CUSTGXX form module. Create three global variables called
GLOBAL.INSERT, GLOBAL.UPDATE, and GLOBAL.DELETE.
These variables indicate respectively the number of inserts, updates, and
deletes. You need to write Post-Insert, Post-Update, and Post-Delete
triggers to initialize and increment the value of each global variable.
......................................................................................................................................................
20-46
Oracle Forms Developer: Build Internet Applications I
Practice 20
......................................................................................................................................................
Practice 20 (continued)
7 Create a procedure called HANDLE_MESSAGE. Import the
pr20_10.txt file. This procedure receives two arguments. The first
one is a message number, and the second is a Boolean error indicator.
This procedure uses the three global variables to display a customized
commit message and then erases the global variables.
PROCEDURE handle_message( message_number IN NUMBER, IS_ERROR IN
BOOLEAN ) IS
BEGIN
IF message_number IN ( 40400, 40406, 40407 ) THEN
DEFAULT_VALUE( 0, GLOBAL.insert );
DEFAULT_VALUE( 0, GLOBAL.update );
DEFAULT_VALUE( 0, GLOBAL.delete );
MESSAGE('Save Ok: ' ||
:GLOBAL.insert || records inserted, ||
:GLOBAL.update || records updated, ||
:GLOBAL.delete || records deleted !!! );
ELSIF is_error = TRUE THEN
MESSAGE(ERROR: || ERROR_TEXT );
ELSE
MESSAGE( MESSAGE_TEXT );
END IF;
END ;
Call the procedure when an error occurs. Pass the error code and TRUE. Call the
procedure when a message occurs. Pass the message code and FALSE.
8 Open the CUSTGXX form module. Write an On-Logon trigger to control
the number of connection tries. Use the LOGON_SCREEN built-in to
simulate the default login screen and LOGON to connect to the database.
You can import the pr20_11.txt file.
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
20-47
Lesson
20: Transaction Processing
......................................................................................................................................................
......................................................................................................................................................
20-48
Oracle Forms Developer: Build Internet Applications I
21
................................
Lesson
21: Writing Flexible Code
......................................................................................................................................................
Objectives
Schedule
Topic
Lecture
Practice
Total
Timing
50 minutes
30 minutes
80 minutes
......................................................................................................................................................
21-2
Oracle Forms Developer: Build Internet Applications I
Introduction
......................................................................................................................................................
Introduction
Overview
Form Builder has a variety of features that enable you to write code in a flexible,
reusable way.
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
21-3
Lesson
21: Writing Flexible Code
......................................................................................................................................................
Flexible Code
Is reusable code
Is generic code
Avoids hard-coded object names
Makes maintenance easier
Increases productivity
......................................................................................................................................................
21-4
Oracle Forms Developer: Build Internet Applications I
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
21-5
Lesson
21: Writing Flexible Code
......................................................................................................................................................
Input focus:
SYSTEM.CURSOR_BLOCK
SYSTEM.CURSOR_RECORD
SYSTEM.CURSOR_ITEM
SYSTEM.CURSOR_VALUE
Trigger focus:
SYSTEM.TRIGGER_BLOCK
SYSTEM.TRIGGER_RECORD
SYSTEM.TRIGGER_ITEM
......................................................................................................................................................
21-6
Oracle Forms Developer: Build Internet Applications I
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
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. You can examine the system variables by using the Debugger.
Instructor Note
SYSTEM.CURRENT_BLOCK, SYSTEM.CURRENT_FORM,
SYSTEM.CURRENT_ITEM, and SYSTEM.CURRENT_VALUE are included for
compatibility with earlier versions (version 3.0 and earlier) of Forms.
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
21-7
Lesson
21: Writing Flexible Code
......................................................................................................................................................
Instructor Note
Explain that the first example performs a commit before clearing a block if there are
changes to commit within that block.
Explain that the second example is a form-level trigger code for testing the current
block name and then navigating depending on the result.
......................................................................................................................................................
21-8
Oracle Forms Developer: Build Internet Applications I
SYSTEM.BLOCK_STATUS
CHANGED
NEW
QUERY
SYSTEM.FORM_STATUS
CHANGED
NEW
QUERY
Description
The record was fetched from the database, and a base table
item on the record has been updated.
The user (or a trigger) has entered a value into a base table
item of a nonfetched record.
The user (or a trigger) has not yet entered any values into
the base table items of the record.
The record was fetched from the database, but no base
table item on the record has been updated.
Description
The block contains at least one record with a status of
CHANGED or INSERT.
The block contains only NEW records.
The block contains only QUERY records.
Description
The form contains at least one record with a status of
CHANGED or INSERT.
The form contains only NEW records.
The form contains only QUERY records.
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
21-9
Lesson
21: Writing Flexible Code
......................................................................................................................................................
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
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
......................................................................................................................................................
21-10
Oracle Forms Developer: Build Internet Applications I
GET_BLOCK_PROPERTY
The GET_BLOCK_PROPERTY built-in returns information about a specified block.
Example
To determine the current record that is visible at the first (top) line of a block:
...GET_BLOCK_PROPERTY(blockname,top_record)...
GET_ITEM_PROPERTY
The GET_ITEM_PROPERTY built-in returns information about a specified item.
Example
To determine the canvas that the item with the input focus displays on, use:
DECLARE
cv_name varchar2(30);
BEGIN
cv_name := GET_ITEM_PROPERTY(:SYSTEM.CURSOR_ITEM,item_canvas);
...
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
21-11
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
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
Instructor Note
Use SET_ITEM_PROPERTY to change fonts and colors directly. Use the
SetFontDemo.fmb file.
......................................................................................................................................................
21-12
Oracle Forms Developer: Build Internet Applications I
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.
Example
The following example sets the visual attribute to VA_CURR for the current record of
the current item:
SET_ITEM_INSTANCE_PROPERTY(:SYSTEM.CURSOR_ITEM,
VISUAL_ATTRIBUTE, CURRENT_RECORD, VA_CURR);
SET_MENU_ITEM_PROPERTY
The SET_MENU_ITEM_PROPERTY built-in modifies the given properties of a
menu item.
Example
To enable the save menu item in a file menu:
SET_MENU_ITEM_PROPERTY(FILE.SAVE,ENABLED,PROPERTY_TRUE);
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 tab_page_1, if it is already disabled, use:
DECLARE
tbpg_id TAB_PAGE;
BEGIN
tbpg_id := FIND_TAB_PAGE(tab_page_1);
IF GET_TAB_PAGE_PROPERTY(tbpg_id, enabled) = FALSE THEN
SET_TAB_PAGE_PROPERTY(tbpg_id, enabled, property_true);
END IF;
END;
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
21-13
Lesson
21: Writing Flexible Code
......................................................................................................................................................
Object IDs
Finding the object ID:
ID
lov_id
lov_id :=
:= FIND_LOV(my_lov)
FIND_LOV(my_lov)
ID
......................................................................................................................................................
21-14
Oracle Forms Developer: Build Internet Applications I
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
21-15
Lesson
21: Writing Flexible Code
......................................................................................................................................................
FIND_ Built-Ins
FIND_FORM
FIND_BLOCK
FIND_ITEM
ID
FIND_RELATION
FIND_LOV
FIND_ Built-Ins
FIND_WINDOW
FIND_VIEW
FIND_CANVAS
ID
FIND_ALERT
FIND_EDITOR
......................................................................................................................................................
21-16
Oracle Forms Developer: Build Internet Applications I
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
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
21-17
Lesson
21: Writing Flexible Code
......................................................................................................................................................
Example:
DECLARE
item_var item;
BEGIN
item_var := FIND_ITEM(:SYSTEM.CURSOR_ITEM);
SET_ITEM_PROPERTY(item_var,position,30,55);
SET_ITEM_PROPERTY(item_var,prompt_text,Current);
END;
......................................................................................................................................................
21-18
Oracle Forms Developer: Build Internet Applications I
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. The following calls are logically
equivalent:
SET_ITEM_PROPERTY(S_ITEM.price,position,50,35);
SET_ITEM_PROPERTY(id_var,position,50,35);
You can use either object IDs or object names in the same argument list, provided that
each individual argument refers to a distinct object.
You cannot, however, use an object ID and an object name to form a fully qualified
object_name (blockname.itemname). The following call is illegal:
GO_ITEM(block_id.item_name);
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.
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
21-19
Lesson
21: Writing Flexible Code
......................................................................................................................................................
......................................................................................................................................................
21-20
Oracle Forms Developer: Build Internet Applications I
You can pass the global variable around within the application. To be able to reuse the
object ID, you need to convert it back to its original data type.
Example
The following example shows the conversion of the global variable back to its original
PL/SQL variable data type:
DECLARE
item_var item;
BEGIN
item_var.id := TO_NUMBER(:GLOBAL.item);
GO_ITEM(item_var);
END;
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
21-21
Lesson
21: Writing Flexible Code
......................................................................................................................................................
KIDSPORT
ITEM B
Indirect reference
ITEM A
ITEM A
Kidsport
......................................................................................................................................................
21-22
Oracle Forms Developer: Build Internet Applications I
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
21-23
Lesson
21: Writing Flexible Code
......................................................................................................................................................
Returns:
The contents of variable
Character string
Direct copy
COPY(Kidsport,S_CUSTOMER.name);
Indirect copy
COPY(Kidsport,:GLOBAL.customer_name);
COPY(Kidsport,:GLOBAL.customer_name);
......................................................................................................................................................
21-24
Oracle Forms Developer: Build Internet Applications I
The return value of NAME_IN is always a character string. To use NAME_IN for a
date or number item, convert the string to the desired data type with the appropriate
conversion function. For instance:
date_var := TO_DATE(NAME_IN(S_ORD.date_ordered));
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, as in the following example:
COPY(Kidsport,NAME_IN(GLOBAL.customer_name));
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
21-25
Lesson
21: Writing Flexible Code
......................................................................................................................................................
Summary
Summary
......................................................................................................................................................
21-26
Oracle Forms Developer: Build Internet Applications I
Summary
......................................................................................................................................................
Summary
Use the following to write flexible code:
System variables:
- To avoid hard-coding object names
- To return information about the current state of the form
GET_object_PROPERTY built-ins, to return current property values for
Form Builder objects
Object IDs, to improve performance
Indirect referencing, to allow form module variables to be referenced in
library and menu modules
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
21-27
Lesson
21: Writing Flexible Code
......................................................................................................................................................
Practice 21 Overview
Note
For solutions to this practice, see Practice 21 in Appendix A, Practice Solutions.
......................................................................................................................................................
21-28
Oracle Forms Developer: Build Internet Applications I
Practice 21 Overview
......................................................................................................................................................
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.
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
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
21-29
Lesson
21: Writing Flexible Code
......................................................................................................................................................
Practice 21
1 In the ORDGXX form, alter the triggers that populate the Product_Image
......................................................................................................................................................
21-30
Oracle Forms Developer: Build Internet Applications I
22
................................
Lesson
22: Sharing Objects and Code
......................................................................................................................................................
Objectives
Schedule
Topic
Lecture
Practice
Total
Timing
50 minutes
30 minutes
80 minutes
......................................................................................................................................................
22-2
Oracle Forms Developer: Build Internet Applications I
Introduction
......................................................................................................................................................
Introduction
Overview
Form Builder includes some features specifically for object and code reuse. In this
lesson, you learn how to share objects between form modules using the Object
Library. You also learn how to share code using the PL/SQL Library.
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
22-3
Lesson
22: Sharing Objects and Code
......................................................................................................................................................
Increases productivity
Decreases maintenance
Increases modularity
Maintains standards
......................................................................................................................................................
22-4
Oracle Forms Developer: Build Internet Applications I
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
22-5
Lesson
22: Sharing Objects and Code
......................................................................................................................................................
Property Classes
Canvas
Relation
properties
properties
Block
Item
properties
properties
LOV
properties
......................................................................................................................................................
22-6
Oracle Forms Developer: Build Internet Applications I
Property Class
......................................................................................................................................................
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, but for several at a time. This results in increased productivity, because it
eliminates the time spent on setting identical properties for several objects.
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
22-7
Lesson
22: Sharing Objects and Code
......................................................................................................................................................
Inherit Property
Delete Property
Property Class
Instructor Note
Create a property class in the Property Palette.
Create a property class in the Object Navigator.
Include properties for different objects.
Associate a property class with an object.
......................................................................................................................................................
22-8
Oracle Forms Developer: Build Internet Applications I
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
22-9
Lesson
22: Sharing Objects and Code
......................................................................................................................................................
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
Inheriting Properties
......................................................................................................................................................
22-10
Oracle Forms Developer: Build Internet Applications I
Lesson
22: Sharing Objects and Code
......................................................................................................................................................
Object Group
Is a logical container
Enables you to:
Group related objects
Copy multiple objects in one operation
......................................................................................................................................................
22-12
Oracle Forms Developer: Build Internet Applications I
Lesson
22: Sharing Objects and Code
......................................................................................................................................................
Blocks include:
Items
Item-level triggers
Block-level triggers
Relations
Instructor Note
Point out that the objects in the object group are still visible in their
respective positions in the Object Navigator.
Drag the object group and drop it into a second form module.
......................................................................................................................................................
22-14
Oracle Forms Developer: Build Internet Applications I
Lesson
22: Sharing Objects and Code
......................................................................................................................................................
Copying Objects
Company Name:
Company Code:
Balance:
Ability to
make exact
copy of object
Company Name:
Company Code:
Balance:
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:
......................................................................................................................................................
22-16
Oracle Forms Developer: Build Internet Applications I
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:
Instructor Note
If you create an object without subclassing it, then change the properties from the
default values, and later decide to subclass the object, it never inherits those
overridden properties from the parent. This conforms to the inheritance model above,
but it is not always well understood.
......................................................................................................................................................
22-18
Oracle Forms Developer: Build Internet Applications I
Subclassing an Object
Earlier versions of Form Builder provided only the ability to inherit from a base class,
and this severely limited the usefulness of the reference mechanism. Subclassing is
similar to referencing in Oracle Forms Developer Release 1, but is more powerful and
reflects true object subclassing.
Ability to Add to an Object
You can still create an exact copy of an object, as with referencing, but you can add to
the subclassed object. For example, you can add additional items to a subclassed
block.
Ability to Alter Properties
With subclassing, you can make an exact copy and then alter the properties of some
objects. If you change the parent class, the changes also apply to the properties of the
subclassed object that you have not altered. However, any properties that you override
remain overridden.
This provides a powerful object inheritance model. With Property Palette, you can
identify inherited or overridden properties.
Property Palette Icon
Meaning
Circle
Square
The value for the property was changed from the default.
Arrow
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
22-19
Lesson
22: Sharing Objects and Code
......................................................................................................................................................
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:
......................................................................................................................................................
22-20
Oracle Forms Developer: Build Internet Applications I
Lesson
22: Sharing Objects and Code
......................................................................................................................................................
An Object Library
......................................................................................................................................................
22-22
Oracle Forms Developer: Build Internet Applications I
Lesson
22: Sharing Objects and Code
......................................................................................................................................................
Object Libraries
......................................................................................................................................................
22-24
Oracle Forms Developer: Build Internet Applications I
......................................................................................................................................................
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
......................................................................................................................................................
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
......................................................................................................................................................
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.
......................................................................................................................................................
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
......................................................................................................................................................
......................................................................................................................................................
22-32
Oracle Forms Developer: Build Internet Applications I
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
22-33
Lesson
22: Sharing Objects and Code
......................................................................................................................................................
Searches
Program Units
PROCA
PROCB
Attached Libraries
Database
......................................................................................................................................................
22-34
Oracle Forms Developer: Build Internet Applications I
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
22-35
Lesson
22: Sharing Objects and Code
......................................................................................................................................................
Summary
Summary
......................................................................................................................................................
22-36
Oracle Forms Developer: Build Internet Applications I
Summary
......................................................................................................................................................
Summary
Forms provides a variety of methods for reusing objects and code. This lesson
described how to use these methods.
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; extends referencing to include object-oriented capabilities
Creating a library module
Using object libraries: Enables drag and drop reuse, and provides
SmartClasses for default objects
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
22-37
Lesson
22: Sharing Objects and Code
......................................................................................................................................................
Practice 22 Overview
Note
For solutions to this practice, see Practice 22 in Appendix A, Practice Solutions.
......................................................................................................................................................
22-38
Oracle Forms Developer: Build Internet Applications I
Practice 22 Overview
......................................................................................................................................................
Practice 22 Overview
In this practice, you use an object group and an object library to copy Form Builder
objects from one form to another. You will also create a property class and use it to set
multiple properties for several objects. You set SmartClasses in the object library and
use these classes in the form module.
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
Lesson
22: Sharing Objects and Code
......................................................................................................................................................
Practice 22
1 In the ORDGXX form, create an object group, called Stock_Objects,
Setting
Font Name
Arial
Format Mask
99,999
Font Size
Justification
Right
Delete Allowed
No
Background Color
DarkRed
Max_In_Stock item.
Save the form module as STOCKXX.fmb, compile, run the form, and
note the error.
Make the Restock_Date format mask a variant property.
Change the format mask for S_INVENTORY.Restock_Date to MM/DD/YYYY.
Save, compile, and run the form. Correct the error. Save, compile, and
run the form again.
Create an object library and name it summit.
Create two tabs in the object library called Personal and Corporate.
Add the CONTROL block, the Toolbar, and the Question_Alert to the personal tab
of the object library.
Save the object library as summit.olb.
......................................................................................................................................................
22-40
Oracle Forms Developer: Build Internet Applications I
Practice 22
......................................................................................................................................................
Practice 22 (continued)
10 Create a new form, and create a data block based on the S_DEPT table.
Drag the Toolbar canvas, CONTROL block, and Question_Alert from the object
library into the new form. For proper behavior, the S_DEPT block must be before
the CONTROL block in the Object Navigator. Subclass the objects.
Some items are not applicable to this form. Set the Canvas property for the
following items to NULL: Image_Button, Stock_Button, Show_Help_Button,
Product_Lov_Button, Hide_Help_Button.
Use Toolbar as the form horizontal toolbar canvas for this form.
Set the Window property to WINDOW1 for the Toolbar canvas.
Set the Horizontal Toolbar Canvas property to TOOLBAR for the window.
Save this form as DEPTGXX, compile, and run the form to test it.
11 Try to delete items on the Null canvas. What happens and why?
12 Create two sample buttons, one for wide buttons and one for medium
buttons, by means of width.
Create a sample date field. Set the width and the format mask to your preferred
standard.
Drag these items into your object library.
Mark these items as SmartClasses.
Create a new form and a new data block in the form. Apply these SmartClasses in
your form. Place the Toolbar canvas in the new form.
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
22-41
Lesson
22: Sharing Objects and Code
......................................................................................................................................................
......................................................................................................................................................
22-42
Oracle Forms Developer: Build Internet Applications I
23
................................
Introducing Multiple
Form Applications
Lesson
23: Introducing Multiple Form Applications
......................................................................................................................................................
Objectives
Schedule
Topic
Lecture
Practice
Total
Timing
50 minutes
30 minutes
80 minutes
......................................................................................................................................................
23-2
Oracle Forms Developer: Build Internet Applications I
Introduction
......................................................................................................................................................
Introduction
Overview
Oracle Forms Developer applications rarely consist of a single form document. 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
Lesson
23: Introducing Multiple Form Applications
......................................................................................................................................................
Behavior:
Flexible navigation between windows
Single or multiple database connections
Transactions may span forms, if required
Commits in order of opening forms, starting
with current form
Links:
Data is exchanged by global variables or
parameter lists
Code is shared as required, through libraries
and the database
Copyright Oracle Corporation, 2000. All rights reserved.
Form C
Open
Open
Form A
Form B
Open
Form D
Global variables
Copyright Oracle Corporation, 2000. All rights reserved.
......................................................................................................................................................
23-4
Oracle Forms Developer: Build Internet Applications I
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
23-5
Lesson
23: Introducing Multiple Form Applications
......................................................................................................................................................
OPEN_FORM
MDI
MDI
FORM A
FORM A
OPEN_FORM
FORM B
Modeless
Instructor Note
The broken line indicates that control need not pass immediately to the opened form
(depending on the Activate_Mode argument). This course concentrates mainly on
OPEN_FORM, 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.
......................................................................................................................................................
23-6
Oracle Forms Developer: Build Internet Applications I
Description
Form_Name
Activate_Mode
Session_Mode
Data_Mode
Paramlist
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
23-7
Lesson
23: Introducing Multiple Form Applications
......................................................................................................................................................
Scenario:
Run the CUSTOMERS and ORDERS forms in the
same session, navigating freely between them.
You can make changes in the same transaction
across forms. All forms are visible together.
Actions:
1. Define windows and positions for each form.
2. Plan global variables and their names.
3. Implement triggers to:
Open other forms
Initialize globals from calling forms
Use globals in opened forms
......................................................................................................................................................
23-8
Oracle Forms Developer: Build Internet Applications I
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
23-9
Lesson
23: Introducing Multiple Form Applications
......................................................................................................................................................
ORDERS
Order
Customer_ID
GLOBAL.CUSTOMERID
......................................................................................................................................................
23-10
Oracle Forms Developer: Build Internet Applications I
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
23-11
Lesson
23: Introducing Multiple Form Applications
......................................................................................................................................................
Notes
Execute_Query;
Execute_Query;
Pre-Query
:S_ORD.customer_id
:S_ORD.customer_id :=
:= :GLOBAL.customerid;
:GLOBAL.customerid;
......................................................................................................................................................
23-12
Oracle Forms Developer: Build Internet Applications I
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
23-13
Lesson
23: Introducing Multiple Form Applications
......................................................................................................................................................
DEFAULT_VALUE(,
DEFAULT_VALUE(, GLOBAL.customerid);
GLOBAL.customerid);
Conditional Opening
Example:
:GLOBAL.customerid := :S_CUSTOMER.id;
IF ID_NULL(FIND_FORM(ORDERS)) THEN
OPEN_FORM(ORDERS);
ELSE
GO_FORM(ORDERS);
END IF;
......................................................................................................................................................
23-14
Oracle Forms Developer: Build Internet Applications I
You can provide independence, and ensure that global variables exist by using the
DEFAULT_VALUE built-in when the form is opening.
Example
This Pre-Form trigger in the ORDERS form assigns a NULL value to
GLOBAL.CUSTOMERID if it does not exist when the form starts. Because the
Pre-Form trigger fires before record creation, and before all of the
When-New-Object-Instance triggers, it ensures existence of global variables at the
earliest point.
DEFAULT_VALUE(, GLOBAL.customerid);
The ORDERS form can now potentially be called without the CUSTOMERS form.
Conditional Opening
Here is a variation of the When-Button-Pressed trigger on Orders_Button in the
CUSTOMERS form. If the ORDERS form is already running, it simply passes control
to it, using GO_FORM.
:GLOBAL.customerid := :S_CUSTOMER.id;
IF ID_NULL(FIND_FORM(ORDERS)) THEN
OPEN_FORM(ORDERS);
ELSE
GO_FORM(ORDERS);
END IF;
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
23-15
Lesson
23: Introducing Multiple Form Applications
......................................................................................................................................................
Form C
Form B
Runtime
Form A
Will the last one out please turn off the lights
Copyright Oracle Corporation, 2000. All rights reserved.
ENTER;
ENTER;
IF
IF :SYSTEM.FORM_STATUS
:SYSTEM.FORM_STATUS == CHANGED
CHANGED THEN
THEN
EXIT_FORM(
EXIT_FORM( DO_COMMIT
DO_COMMIT );
);
ELSE
ELSE
EXIT_FORM(
EXIT_FORM( NO_COMMIT
NO_COMMIT );
);
END
IF;
END IF;
......................................................................................................................................................
23-16
Oracle Forms Developer: Build Internet Applications I
If you are closing a form with EXIT_FORM, the default functionality is the same as
described above. You can, however, make the decision to commit (save) or roll back
through the EXIT_FORM built-in, so the user is not asked. Typically, you might use
this built-in from a Key-Exit or When-Button-Pressed trigger.
EXIT_FORM(commit_mode)
Parameter
Description
Commit_Mode
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
23-17
Lesson
23: Introducing Multiple Form Applications
......................................................................................................................................................
Note
The system variable SYSTEM.FORM_STATUS contains the value CHANGED if
there are uncommitted changes in the current form. You can use this variable to decide
whether to attempt a commit in a trigger.
......................................................................................................................................................
23-18
Oracle Forms Developer: Build Internet Applications I
Example
In the opened form (ORDERS), a When-Create-Record trigger on the S_ORD block
ensures that new records use the value of GLOBAL.CUSTOMERID as their default.
When items are assigned from this trigger, the record status remains NEW, so that the
user can leave the record without completing it.
:S_ORD.customer_id := :GLOBAL.customerid;
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
23-19
Lesson
23: Introducing Multiple Form Applications
......................................................................................................................................................
Summary
......................................................................................................................................................
23-20
Oracle Forms Developer: Build Internet Applications I
Summary
......................................................................................................................................................
Summary
This lesson is an introduction lesson to multiple form applications. In the course
Oracle Forms Developer: Build Internet Applications II, there is another lesson that
covers this subject in detail. In this lesson, you should have learned how to open more
than one form module in a Forms Runtime session, and how to pass information
among forms.
The OPEN_FORM built-in provides multiple concurrent forms in a
session.
Forms communicate through global variables:
- Load key values in the parent form.
- Use global values in opened forms, particularly for
When-New-Form-Instance and Pre-Query.
Close a form by using the EXIT_FORM buildt-in.
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:
- OPEN_FORM, CALL_FORM, NEW_FORM built-ins
- Closing forms
- Navigating between forms
Passing data between forms:
- Form parameters
- Parameter lists
Multiple form transactions
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
23-21
Lesson
23: Introducing Multiple Form Applications
......................................................................................................................................................
Practice 23 Overview
Note
For solutions to this practice, see Practice 23 in Appendix A, Practice Solutions.
......................................................................................................................................................
23-22
Oracle Forms Developer: Build Internet Applications I
Practice 23 Overview
......................................................................................................................................................
Practice 23 Overview
In this practice, you produce a multiple form application by linking the CUSTGXX and
the ORDGXX form modules.
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
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
23-23
Lesson
23: Introducing Multiple Form Applications
......................................................................................................................................................
Practice 23
1 In the ORDGXX form, create a Pre-Form trigger to ensure that a global
3
4
5
7
8
10
......................................................................................................................................................
23-24
Oracle Forms Developer: Build Internet Applications I
A
................................
Practice Solutions
Appendix
A: Practice Solutions
......................................................................................................................................................
Practice 1 Solutions
1 Invoke Form Builder, and select Open an existing form from the
2
3
5
6
7
8
Welcome page.
No formal solution.
Open the Orders.fmb form module from the Open Dialog window.
No formal solution.
Change your preferences so that when you open or save a file, Form
Builder gives you the option of saving the file to the file system or the
database.
Select Tools>Preferences from the default menu system. Click the
Access tab in the Preferences dialog box.
Click the Ask option. Click OK.
Try to open the Customers.fmb form module. Notice that the module
access dialog box is displayed. Click Cancel.
Modify your preferences so that Form Builder will access the file system
only.
Select Tools>Preferences from the default menu system. Click the
Access tab in the Preferences dialog box.
Click the File option. Click OK.
Close the ORDERS form.
No formal solution.
Open the Summit.fmb form module.
No formal solution.
Expand the Data Blocks node.
No formal solution.
Expand the Database Objects node. If you cannot expand the node,
connect to the database and try again. What do you see below this node?
No formal solution.
Collapse the Data Blocks node.
No formal solution.
......................................................................................................................................................
A-2
Oracle Forms Developer: Build Internet Applications I
Practice 1 Solutions
......................................................................................................................................................
screenshot shown below. At the end, save your changes, and exit Form
Builder.
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
A-3
Appendix
A: Practice Solutions
......................................................................................................................................................
......................................................................................................................................................
A-4
Oracle Forms Developer: Build Internet Applications I
Practice 2 Solutions
......................................................................................................................................................
Practice 2 Solutions
Running a Forms Application on the Web
1 Run the form module Customers on the Web.
Double-click the shortcut on your desktop for Run a Form on the Web.
Enter the Runform parameters and run the Customers form.
No formal solution.
2 Select Help>Keys from the menu.
No formal solution.
3 Execute an unrestricted query.
Select Query>Execute, or press [Execute Query], or click the
Execute Query toolbar button.
Press [Up] and [Down] to browse through the records returned.
4 Execute a restricted query to retrieve information about the customer
with the ID of 212.
Put the form module in Enter Query mode (press [F11] or select
Query>Enter from menu).
Notice that the status line displays the words ENTER-QUERY.
Move to the Id item and enter the search value 212.
Execute the query (press [Ctrl] + [F11] or select Query>Execute
from menu).
Notice that only one record is retrieved.
5 Exit this run-time session.
No formal solution.
6 Start another run-time session on the Web using the form module
Customers. For this session, set the Runform parameter Look and Feel to
Oracle. Notice the different appearance of the user interface.
No formal solution.
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).
Notice that the status line displays the words ENTER-QUERY.
Move to the Name item and enter the search value Womansport.
Execute the query (press [Ctrl] + [F11] or select Query>Execute
from menu).
Notice that only one record is retrieved.
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
A-5
Appendix
A: Practice Solutions
......................................................................................................................................................
10
11
12
13
14
......................................................................................................................................................
A-6
Oracle Forms Developer: Build Internet Applications I
Practice 2 Solutions
......................................................................................................................................................
2 Select Help>Keys from the menu. Notice that the function keys are
Value
Todays date (DD-MON-YYYY)
Cash (radio group button)
No (unchecked)
Value
50530
2
10
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
A-7
Appendix
A: Practice Solutions
......................................................................................................................................................
......................................................................................................................................................
A-8
Oracle Forms Developer: Build Internet Applications I
4 In the Layout Editor, reposition the items so that the canvas resembles
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
A-9
Appendix
A: Practice Solutions
......................................................................................................................................................
......................................................................................................................................................
A-10
Oracle Forms Developer: Build Internet Applications I
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
A-11
Appendix
A: Practice Solutions
......................................................................................................................................................
......................................................................................................................................................
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 customers 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
......................................................................................................................................................
10
11
......................................................................................................................................................
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
......................................................................................................................................................
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
A-17
Appendix
A: Practice Solutions
......................................................................................................................................................
ORDGXX Form
6 In the S_ORD block, create a new text item called Customer_Name.
Ensure that Customer_Name is not associated with the S_ORD table.
Do not allow insert, update, or query operations on this item, and make
sure that navigation is possible only by means of the mouse. Set the
Prompt text to Customer Name. Display this item on CV_ORDER
canvas.
Create a text item and name it Customer_Name.
Item Type should be set to Text Item.
Set the Database Item, Insert Allowed, Update Allowed, Query
Allowed, and Keyboard Navigable properties to No.
Set the Prompt to Customer Name.
Set the Canvas property to CV_ORDER.
7 In the S_ORD block, create a new text item called Sales_Rep_Name.
Ensure that Sales_Rep_Name is not associated with the S_ORD table.
Do not allow insert, update, or query operations on this item and make
sure that navigation is possible only by means of the mouse. Set the
Prompt text to Sales Rep Name. Display this item on the CV_ORDER
canvas.
Create a text item and name it Sales_Rep_Name.
Item Type should be set to Text Item.
Set the Database Item, Insert Allowed, Update Allowed, Query
Allowed, and Keyboard Navigable properties to No.
Set the Prompt to Sales Rep Name.
Set the Canvas property to CV_ORDER.
8 Set the relevant property for Date_Ordered, so that it displays the current
date whenever a new record is entered.
For Date_Ordered, set Initial Value to $$date$$.
9 In the S_ITEM block, create a new text item called Item_Total.
Ensure that Item_Total is not associated with the S_ITEM table.
Do not allow insert, update, or query operations on this item and make
sure that navigation is possible only by means of the mouse.
Allow numeric data only and display it by using a format of
999G990D99.
Set the Prompt text to Item Total. Display this item on the CV_ORDER
canvas.
Create a text item and name it Item_Total.
Item Type should be set to Text Item.
Set the Database Item, Insert Allowed, Update Allowed, Query
......................................................................................................................................................
A-18
Oracle Forms Developer: Build Internet Applications I
Practice 6 Solutions
......................................................................................................................................................
Suggested Width
40
66
66
116
66
116
66
48
18
Suggested Width
20
40
42
26
26
86
Instructor Note
Customer_Name and Sales_Rep_Name are created as text items in this course. They
could also be created as display items. Display items use less memory than text items.
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
A-19
Appendix
A: Practice Solutions
......................................................................................................................................................
......................................................................................................................................................
A-20
Oracle Forms Developer: Build Internet Applications I
Practice 6 Solutions
......................................................................................................................................................
No formal solution.
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
A-21
Appendix
A: Practice Solutions
......................................................................................................................................................
Practice 7 Solutions
1 In the ORDGXX form, create an LOV to display product numbers and
id, name
s_product
name
......................................................................................................................................................
A-22
Oracle Forms Developer: Build Internet Applications I
Practice 7 Solutions
......................................................................................................................................................
numbers and their names, using the LOV Wizard. Use the S_EMP table,
Id, First_Name, and Last_Name columns. Concatenate the First_Name
and the Last_Name columns and give an alias such as Name.
Assign a title of Sales Representatives to the LOV. Assign a column
width of 20 for ID, and assign the LOV a width of 200 and a height of
250. Position the LOV 30 pixels below and to the right of the upper-left
corner. For the ID column, set the return item to
S_CUSTOMER.SALES_REP_ID. Attach the LOV to the Sales_Rep_Id
item in the S_CUSTOMER block.
Change the name of the LOV to SALES_REP_LOV.
Create a new LOV. Click the OK button to use the LOV Wizard.
Select the New Record Group based on a query radio button, and
click the Next button.
In the SQL Query Statement, enter:
Select
id, first_name || || last_name Name
From
s_emp
Where title = Sales Representative
Order By
last_name
and click the Next button.
Click the >> button and then the Next button to select both of the record
group values.
With the ID column selected, click the Look up return item button. Select
S_CUSTOMER.SALES_REP_ID and click the OK button. Set the display
width for ID to 20 and click the Next button. Enter the title Sales
Representatives. Assign the LOV a width of 200 and a height of 250. Select the
No, I want to position it manually radio button, and set both Left and Top
to 30. Click the Next button.
Click the Next button to accept the default advanced properties.
Click the > button and then the Finish button to create the LOV and attach it
to the Sales_Rep_Id item.
In the Object Navigator, change the name of the new LOV to
SALES_REP_LOV.
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
A-23
Appendix
A: Practice Solutions
......................................................................................................................................................
item. Set the title to Comments, the background color to gray, and the
foreground color to yellow.
Create a new editor. Change the name to Comments_Editor.
Set the X Position and Y Position properties to 175.
Set the Width property to 450 and the Height property to 250.
Set the title to Comments, Background Color property to gray, and
the Foreground Color property to yellow.
In the Property Palette of the Comments item, set the Editor
property to Comments_Editor.
5 Save, compile, and run the form to test the changes. Resize the window
if necessary.
No formal solution.
......................................................................................................................................................
A-24
Oracle Forms Developer: Build Internet Applications I
Practice 8 Solutions
......................................................................................................................................................
Practice 8 Solutions
1 In the CUSTGXX form, convert the Credit_Rating text item into a
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
A-25
Appendix
A: Practice Solutions
......................................................................................................................................................
Add radio buttons for Cash and Credit to represent database values of
CASH and CREDIT.
Define access keys of S for cash and T for credit.
Add text Payment type to describe the radio groups purpose.
Set Label to Cash for the Cash radio button and Credit for the Credit
radio button.
Ensure that new records display the default of Cash.
For Payment_Type, set Item Type to Radio Group.
Set the Initial Value to CASH.
Expand the Payment_Type node.
The Radio Buttons node is displayed.
Create two buttons; name them Cash_Button and Credit_Button.
For the first button, set Access Key to S, Label to Cash, and Radio
Button Value to CASH. For the second button, set Access Key to T,
Label to Credit, and Radio Button Value to CREDIT.
Use the Layout Editor to position the radio buttons so that both can
be seen.
In the Layout Editor, create boilerplate text to identify radio buttons
as Payment Type.
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.
Drag the items of the S_ORD block according to the visual order of
this block.
6 Save, compile, and run the form to test the changes.
No formal solution.
......................................................................................................................................................
A-26
Oracle Forms Developer: Build Internet Applications I
Practice 9 Solutions
......................................................................................................................................................
Practice 9 Solutions
1 In the S_ITEM block of the ORDGXX form, create a display item called
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
A-27
Appendix
A: Practice Solutions
......................................................................................................................................................
called Product_LOV_Button. Use the list file (do not include the
.ico or .gif extension). Set the Keyboard Navigable property and the
Mouse Navigate property to No.
Display the Layout Editor and ensure that the block is set to
CONTROL.
Select the Push Button tool.
Create a push button and place it close to the Product_Id.
Resize the push button.
Set the Name to Product_LOV_Button.
Set the Iconic property to Yes, and set the Icon File Name to List.
Set the Keyboard Navigable property to No.
Set the Mouse Navigate property to No.
5 To display item total information, 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.
Set the Formula property to :S_ITEM.quantity_shipped *
:S_ITEM.price.
Set the Keyboard Navigable property to No.
In the Object Navigator, select the Item_Total item in the S_ITEM block, and
open the Property Palette.
Set the Justification property to Right.
Set the Calculation Mode property to Formula.
Set the Formula property to
:S_ITEM.quantity_shipped * :S_ITEM.price.
Set the Keyboard Navigable property to No.
6 To display the total of the item totals, create a new nondatabase item in
the S_ITEM block.
Set the Position, Size, and Prompt properties according to the
screenshot.
Set the Format Mask property to 9G999G990D99.
Set the Justification property to Right.
Set the Number of Items Displayed property to 1.
Make S_ITEM.total a summary item and display summaries of the
item_total values in the S_ITEM block. Ensure that you have set the
Query All Records property to Yes for the S_ITEM block.
......................................................................................................................................................
A-28
Oracle Forms Developer: Build Internet Applications I
Practice 9 Solutions
......................................................................................................................................................
7 Save, compile, and run the form to test the changes. Change the window
size if necessary.
No formal solution.
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
A-29
Appendix
A: Practice Solutions
......................................................................................................................................................
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.
......................................................................................................................................................
A-30
Oracle Forms Developer: Build Internet Applications I
Practice 9 Solutions
......................................................................................................................................................
CONTROL block of form CUSTGXX. Use the list file (do not include
the .ico or .gif extension). Name the push button
Sales_Rep_Lov_Button, and place it next to Sales_Rep_ID.
Display the Layout Editor and ensure that the block is set to
CONTROL.
Select the Push Button tool.
Create a push button and place it close to Sales_Rep_ID.
Resize the push button.
Set Name to Sales_Rep_LOV_Button.
Set Keyboard Navigable to No.
Set Mouse Navigate to No.
Set Iconic to Yes.
Set Icon File Name to List.
10 Save and compile the form. Deploy the form on the Web to test the
changes.
Note: When you test the form on the Web, the iconic button will have a
different image than the same iconic button in the client-server
environment. This is because the image stored in list.gif is different
from the image stored in list.ico.
No formal solution.
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
A-31
Appendix
A: Practice Solutions
......................................................................................................................................................
Practice 10 Solutions
1 Modify the window in the CUSTGXX form. Change the name of the
2
3
......................................................................................................................................................
A-32
Oracle Forms Developer: Build Internet Applications I
Practice 11 Solutions
......................................................................................................................................................
Practice 11 Solutions
Toolbar Canvases
1 In the ORDGXX form, create a horizontal toolbar canvas called Toolbar
in the WIN_ORDER window, and make it the standard toolbar for that
window. Suggested height is 30.
Create a new canvas. Set Name to Toolbar and Height to 30. Set
Canvas Type to Horizontal Toolbar and Window to WIN_ORDER.
In the WIN_ORDER Property Palette of the window, set Horizontal
Toolbar Canvas to Toolbar.
2 Save, compile, and run the form to test.
Notice that the toolbar now uses part of the window space. Adjust the
window size accordingly.
No formal solution.
Create three push buttons in the CONTROL block, as detailed below, and place them
on the Toolbar canvas.
No formal solution.
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:
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
A-33
Appendix
A: Practice Solutions
......................................................................................................................................................
Stacked Canvases
1 Create a stacked canvas named CV_HELP to display help in the
WIN_ORDER window of the ORDGXX form. Suggested visible size is
Viewport Width 270, Viewport Height 215 (points). Place some
application help text on this canvas.
Create a new canvas.
If the Property Palette is not already displayed, click the new canvas
object in the Object Navigator and select Tools>Property Palette.
Set the Canvas Type to Stacked. Name the canvas CV_HELP.
Assign it to the WIN_ORDER window.
Display the stacked canvas in the Layout Editor, and create some
boilerplate text objects with help information about the form.
2 Position the view of the stacked canvas so that it appears in the center of
WIN_ORDER. Ensure that it will not obscure the first enterable item.
Do this by planning the top-left position of the view in the Layout
Editor, while showing CV_ORDER. Define the Viewport X and
Viewport Y Positions in the Property Palette. Do not move the view in
the Layout Editor.
In the Layout Editor, display the CV_ORDER canvas and select
View>Stack Views from the menu, and select CV_HELP from the
list. You can see both canvases in this way. Change Viewport X and
Viewport Y properties in the Property Palette for CV_Help Canvas.
Suggested coordinates: 100, 100.
3 Organize CV_HELP so that it is the last canvas in sequence.
Do this in the Object Navigator. (This ensures the correct stacking order
at run time.)
Drag the Help_Canvas so that it is the last canvas displayed under
the Canvases node.
4 Save and compile the form. Deploy the form on the Web to test the
changes. Note that the stacked canvas is displayed all the time, providing
that it does not obscure the current item in the form.
No formal solution.
......................................................................................................................................................
A-34
Oracle Forms Developer: Build Internet Applications I
Practice 11 Solutions
......................................................................................................................................................
5 Switch off the Visible property of CV_HELP, and then create a push
Details
Label: Hide Help,
Canvas: CV_HELP
Mouse Navigate: No
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
A-35
Appendix
A: Practice Solutions
......................................................................................................................................................
Tab Canvases
Modify the CUSTGXX form in order to use a tab canvas:
1 In the Layout Editor, delete the frame object that covers the
S_CUSTOMER block. Create a tab canvas. In the Layout Editor, set the
Background Color property to gray, Tab style property to Square, and
Bevel property to None.
In the Layout Editor, select the frame that covers S_CUSTOMER
block and delete.
Click the Tab canvas button in the toolbar and create a tab canvas.
In the Property Palette, set the Background Color property to gray,
Corner Style property to Square, and Bevel property to None.
2 Rename the TAB_CUSTOMER tab canvas. Create three tab pages and
label them as Address, Billing, and Comments.
In the Object Navigator, select this tab canvas and open the
Property Palette. Set the Name property to TAB_CUSTOMER.
In the Object Navigator, expand this tab canvas and create three tab
pages.
Set the tab pages label properties as Address, Billing, and
Comments.
3 Design the tab pages according to the following screenshots. Set the item
properties to make them visible on the relevant tab pages.
In the Object Navigator, select NAME, ADDRESS, CITY, STATE,
COUNTRY, ZIP_CODE, and PHONE items of the S_CUSTOMER block and
open the Property Palette for this multiple selection.
Set the Canvas property to TAB_CUSTOMER.
Set the Tab Page property to the tab page that is labeled Address.
In the Layout Editor, arrange the items according to the following screenshot.
......................................................................................................................................................
A-36
Oracle Forms Developer: Build Internet Applications I
Practice 11 Solutions
......................................................................................................................................................
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
A-37
Appendix
A: Practice Solutions
......................................................................................................................................................
......................................................................................................................................................
A-38
Oracle Forms Developer: Build Internet Applications I
Practice 11 Solutions
......................................................................................................................................................
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
A-39
Appendix
A: Practice Solutions
......................................................................................................................................................
4 Reorder the items according to the tab page sequence. Ensure that the
user does not move from one tab page to another when tabbing through
items. Set the Next Navigation Item and Previous Navigation Item
properties according to the order of items in the tab pages.
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. For example, for the Phone item, set the
Previous Navigation Item property to ZIP_CODE and the Next
Navigation Item property to NAME.
5 Save and compile the form. Deploy the form on the Web.
No formal solution.
......................................................................................................................................................
A-40
Oracle Forms Developer: Build Internet Applications I
Practice 13 Solutions
......................................................................................................................................................
Practice 13 Solutions
1 In the CUSTGXX form, write a trigger to display the Sales_Rep_Lov
form.
When-Window-Closed at the form level:
EXIT_FORM;
3 Save, compile, and run the form.
No formal solution.
4 In the ORDGXX form, write a trigger to display the Products_Lov when
the Products_Lov_Button is selected.
When-Button-Pressed on CONTROL.Products_Lov_Button:
IF SHOW_LOV(products_lov) THEN
NULL;
END IF;
5 Write a trigger that exits the form when the Exit_Button is selected.
When-Button-Pressed on CONTROL.Exit_Button:
EXIT_FORM;
6 Save, compile, and run the form.
No formal solution.
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
A-41
Appendix
A: Practice Solutions
......................................................................................................................................................
test.
The stacked canvas, CV_HELP, is displayed only if the current item will
not be obscured. Ensure, at least, that the first entered item in the form is
one that will not be obscured by CV_HELP.
You might decide to advertise Help only while the cursor is in certain
items, or move the stacked canvas to a position that does not overlay
enterable items.
The CV_HELP canvas, of course, could also be shown in its own
window, if appropriate.
No formal solution.
10 Create a When-Button-Pressed trigger on CONTROL.Stock_Button that
uses the GO_BLOCK built-in to display the S_INVENTORY block.
When-Button-Pressed on CONTROL.Stock_Button:
GO_BLOCK(S_INVENTORY);
......................................................................................................................................................
A-42
Oracle Forms Developer: Build Internet Applications I
Practice 14 Solutions
......................................................................................................................................................
Practice 14 Solutions
1 Open your CUSTGXX.FMB file. In this form, create a procedure that is
your triggers, and investigate the call stack. Try stepping through the
code to monitor its progress.
No formal solution. You can use CUSTWK14.fmb for the completed
form.
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
A-43
Appendix
A: Practice Solutions
......................................................................................................................................................
Practice 15 Solutions
1 In the ORDGXX form, write a trigger that fires when the payment type
......................................................................................................................................................
A-44
Oracle Forms Developer: Build Internet Applications I
Practice 15 Solutions
......................................................................................................................................................
3 Import the pr15_3.txt file into a trigger that fires when the
No formal solution.
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
A-45
Appendix
A: Practice Solutions
......................................................................................................................................................
Practice 16 Solutions
1 Create an alert in ORDGXX called Payment_Type_Alert with a single
OK button. The message should read This customer must pay cash!
Create an alert.
Set Name to PAYMENT_TYPE_ALERT.
Set Title to Payment Type.
Set Alert Style to Caution.
Set Button1 Label to OK.
Set Message to This customer must pay cash!
Remove the labels for the other buttons.
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.
When-Radio-Changed on S_ORD.Payment_Type:
DECLARE
n NUMBER;
v_credit S_CUSTOMER.credit_rating%type;
BEGIN
IF :S_ORDER.payment_type = CREDIT THEN
SELECT credit_rating
INTO v_credit
FROM S_CUSTOMER
WHERE :S_ORD.customer_id = id;
IF v_credit not in(GOOD,EXCELLENT) THEN
:S_ORD.payment_type := CASH;
n := SHOW_ALERT(payment_type_alert);
END IF;
END IF;
END;
3 Create a generic alert called Question_Alert that allows Yes and No
replies.
Create an alert.
Set Name to QUESTION_ALERT.
Set Title to Question.
Set Alert Style to Stop.
Set Button1 Label to Yes.
Set Button2 Label to No.
......................................................................................................................................................
A-46
Oracle Forms Developer: Build Internet Applications I
Practice 16 Solutions
......................................................................................................................................................
uses Question_Alert to ask the operator to confirm that the form should
terminate.
When-Button-Pressed on CONTROL.Exit_Button:
SET_ALERT_PROPERTY(Question_Alert, ALERT_MESSAGE_TEXT,
Do you really want to leave the form?);
IF SHOW_ALERT(Question_Alert) = ALERT_BUTTON1 THEN
EXIT_FORM;
END IF;
5 Save and compile the form. Deploy the form on the Web to test.
No formal solution.
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
A-47
Appendix
A: Practice Solutions
......................................................................................................................................................
Practice 17 Solutions
1 In the ORDGXX form, write a trigger that populates the
......................................................................................................................................................
A-48
Oracle Forms Developer: Build Internet Applications I
Practice 17 Solutions
......................................................................................................................................................
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;
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
A-49
Appendix
A: Practice Solutions
......................................................................................................................................................
Practice 18 Solutions
1 In the CUSTGXX form, cause the Sales_Rep_Lov to be displayed
whenever the user enters a Sales_Rep_Id that does not exist in the
database.
Set the Validate from List property to Yes for the Sales_Rep_Id item
in the S_CUSTOMER block.
2 Save and compile the form. Deploy the form on the Web to test.
No formal solution.
3 In the ORDGXX form, write a validation trigger to check that the
Date_Shipped is not before the Date_Ordered.
When-Validate-Record on S_ORD block:
IF :S_ORD.date_shipped < :S_ORD.date_ordered THEN
MESSAGE(Ship date is before order date!);
RAISE form_trigger_failure;
END IF;
4 In the ORDGXX form, create a trigger to write the correct values to the
......................................................................................................................................................
A-50
Oracle Forms Developer: Build Internet Applications I
Practice 18 Solutions
......................................................................................................................................................
name of the product and suggested wholesale price, and write them to
the Description item and the Price item.
Fail the trigger and display a message if the product is not found.
When-Validate-Item on S_ITEM.Product_Id:
SELECT name,
suggested_whlsl_price
INTO :S_ITEM.description,
:S_ITEM.price
FROM S_PRODUCT
WHERE :S_ITEM.product_id = id;
EXCEPTION
WHEN NO_DATA_FOUND THEN
MESSAGE(Invalid Product Id!);
RAISE form_trigger_failure;
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
A-51
Appendix
A: Practice Solutions
......................................................................................................................................................
Practice 19 Solutions
1 Write a When-New-Form-Instance trigger on the ORDGXX form to
......................................................................................................................................................
A-52
Oracle Forms Developer: Build Internet Applications I
Practice 19 Solutions
......................................................................................................................................................
3 Define the same trigger type and code on the S_ORD block.
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
A-53
Appendix
A: Practice Solutions
......................................................................................................................................................
Practice 20 Solutions
1 In the ORDGXX form, write a transactional trigger on the S_ORD block
that populates S_ORD.Id with the next value from the S_ORD_ID
sequence.
Pre-Insert on S_ORD block:
SELECT S_ORD_ID.nextval
INTO :S_ORD.id
FROM SYS.DUAL;
EXCEPTION
WHEN OTHERS THEN
MESSAGE(Failed to assign Order Id);
RAISE form_trigger_failure;
2 In the S_ORD block, set the Enabled property for the ID item to No.
......................................................................................................................................................
A-54
Oracle Forms Developer: Build Internet Applications I
Practice 20 Solutions
......................................................................................................................................................
6 Open the CUSTGXX form module. Create three global variables called
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
A-55
Appendix
A: Practice Solutions
......................................................................................................................................................
Call the procedure when an error occurs. Pass the error code and TRUE. Call the
procedure when a message occurs. Pass the message code and FALSE.
On-Error at form level:
handle_message( error_code, TRUE );
......................................................................................................................................................
A-56
Oracle Forms Developer: Build Internet Applications I
Practice 20 Solutions
......................................................................................................................................................
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
A-57
Appendix
A: Practice Solutions
......................................................................................................................................................
Practice 21 Solutions
1 In the ORDGXX form, alter the triggers that populate the Product_Image
......................................................................................................................................................
A-58
Oracle Forms Developer: Build Internet Applications I
Practice 21 Solutions
......................................................................................................................................................
No formal solution.
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
A-59
Appendix
A: Practice Solutions
......................................................................................................................................................
Practice 22 Solutions
1 In the ORDGXX form, create an object group, called Stock_Objects,
Setting
Arial
99,999
8
Right
No
DarkRed
Select the Property Classes node and click the Create icon.
In the Property Palette for the property class, set the Name to ClassA.
Add the properties listed by clicking the Add Property icon and selecting
from the list displayed.
Set the properties to the values listed above.
5 Apply ClassA to CV_INVENTORY, the Restock_Date item, and the
Max_In_Stock item.
In the Property Palette for each of the items, select the Subclass
Information property, and click the More button. In the Subclass
Information dialog box, select the Property Class radio button and
set the Property Class Name list item to ClassA.
......................................................................................................................................................
A-60
Oracle Forms Developer: Build Internet Applications I
Practice 22 Solutions
......................................................................................................................................................
6 Save the form module as STOCKXX.fmb, compile, and run the form
10
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
A-61
Appendix
A: Practice Solutions
......................................................................................................................................................
11 Try to delete items on the Null canvas. What happens and why?
You cannot delete the objects because the toolbar and contents are
subclassed from another object.
12 Create two sample buttons, one for wide buttons and one for medium
buttons, by means of width.
Create a sample date field. Set the width and the format mask to your
preferred standard.
Drag these items into your object library.
Mark these items as SmartClasses.
Create a new form and a new data block in the form. Apply these
SmartClasses in your form. Place the Toolbar canvas in the new form.
No formal solution.
......................................................................................................................................................
A-62
Oracle Forms Developer: Build Internet Applications I
Practice 23 Solutions
......................................................................................................................................................
Practice 23 Solutions
1 In the ORDGXX form, create a Pre-Form trigger to ensure that a global
No formal solution.
4 In the CUSTGXX form, create a CONTROL block button called
Orders_Button.
Create a button. Set the Name to ORDERS_BUTTON.
Set Label to Orders.
5 Define a trigger for CONTROL.Orders_Button that initializes
GLOBAL.Customer_Id with the current customers ID, and then opens
the ORDGXX form, passing control to it.
When-Button-Pressed on CONTROL.Orders_Button:
:GLOBAL.customer_id := :S_CUSTOMER.id;
OPEN_FORM(ordgxx);
6 Save and compile each form. Deploy the application to the Web.
No formal solution.
7 Change the window location of the ORDGXX form, if required.
No formal solution.
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
A-63
Appendix
A: Practice Solutions
......................................................................................................................................................
Remember that you need to use the module name in the GO_FORM built-in,
and the filename in the OPEN_FORM built-in.
9 Write a When-Create-Record trigger on the S_ORD block that uses the
value of GLOBAL.Customer_Id as the default value for
S_ORD.Customer_Id.
When-Create-Record on S_ORD block:
:S_ORD.customer_id := :GLOBAL.customer_id;
10 Add code to the CUSTGXX form so that GLOBAL.Customer_Id is
......................................................................................................................................................
A-64
Oracle Forms Developer: Build Internet Applications I
B
................................
Table Descriptions
and Data
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
S_CUSTOMER Description
.....................................................................................................................................................
S_CUSTOMER Description
Column Name
-------------- --------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)
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
B-3
S_CUSTOMER Data
SQL> SELECT * FROM s_customer;
Id
Name
Phone
Address
----------------------- ------------ ----------City
State
Country
------------------ -------------------------Zip_code
Credit_ra
Sales_rep_id Region_id
----------------------------- --------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. This is okay as long as the credit rating remains
excellent.
202
Osaka
Oj Athletics
81-20101
......................................................................................................................................................
B-4
Oracle Forms Developer: Build Internet Applications I
S_CUSTOMER Data
.....................................................................................................................................................
206
Cannes
Sportique
33-2257201
234-603620
6 Saint Antoine
Nigeria
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
B-5
809-352689
11
210
Futbol Sonora
52-404562
3 Via Saguaro
Nogales
EXCELLENT
12
2
Customer is difficult to reach by phone. Try mail.
211
Prague
Kuhns Sports
EXCELLENT
42-111292
15
7 Modrany
Czechoslovakia
5
......................................................................................................................................................
B-6
Oracle Forms Developer: Build Internet Applications I
S_CUSTOMER Data
.....................................................................................................................................................
215
Sporta Russia
7-3892456
6000 Yekatamina
St. Petersburg
Russia
POOR
15
5
This customer is very friendly, but has difficulty paying bills.
Insist upon cash.
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
B-7
Null?
------------NOT NULL
NOT NULL
Datatype
-------------NUMBER(7)
VARCHAR2(25)
NUMBER(7)
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.
......................................................................................................................................................
B-8
Oracle Forms Developer: Build Internet Applications I
S_EMP Description
.....................................................................................................................................................
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,2)
NUMBER(4,2)
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
B-9
S_EMP Data
SQL> SELECT * FROM s_emp;
ID LAST_NAME
FIRST_NAME
USERID
START_DAT
---- ----------------- ----------------------- --------COMMENTS
-------------------------------------------------------------MANAGER_ID TITLE
DEPT_ID SALARY
---------- ---------------------------------- -----COMMISSION_PCT
--------------1 Velasquez
Carmen
cvelasqu 03-MAR-90
President
50 2500
2 Ngao
LaDoris
lngao
08-MAR-90
1 VP, Operations
41
1450
3
Nagayama
1 VP, Sales
Quick-To-See
Mark
1 VP, Finance
mquickto 07-APR-90
10
1450
Ropeburn
Audry
1 VP, Administration
aropebur 04-MAR-90
50
1550
Urguhart
Molly
2 Warehouse Manager
murguhar 18-JAN-91
41
1200
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
Midori
mnagayam 17-JUN-91
31
1400
......................................................................................................................................................
B-10
Oracle Forms Developer: Build Internet Applications I
S_EMP Data
.....................................................................................................................................................
cmagee
14-MAY-90
31
1400
12 Giljum
Henry
3 Sales Representative
12.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.5
adumas
09-OCT-91
35
1450
16 Maduro
Elena
6 Stock Clerk
emaduro 07-FEB-92
41
1400
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
B-11
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
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
---------------------------- bunboot.tif
aceboot.tif
proboot.tif
bunpole.tif
acepole.tif
propole.tif
gpbike.tif
himbike.tif
safthelm.tif
probar.tif
curlbar.tif
baseball.tif
chaphelm.tif
grglove.tif
alglove.tif
stglove.tif
cabbat.tif
pucbat.tif
winbat.tif
19 rows selected.
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
B-13
Null?
-------NOT NULL
NOT NULL
Type
---NUMBER(7)
NUMBER(7)
NUMBER(9)
NUMBER(9)
NUMBER(9)
VARCHAR2(255)
DATE
......................................................................................................................................................
B-14
Oracle Forms Developer: Build Internet Applications I
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
B-15
......................................................................................................................................................
B-16
Oracle Forms Developer: Build Internet Applications I
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
B-17
401
135
100
175
......................................................................................................................................................
B-18
Oracle Forms Developer: Build Internet Applications I
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
B-19
S_ITEM Description
.....................................................................................................................................................
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,2)
NUMBER(9)
NUMBER(9)
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
B-21
S_ITEM Data
SQL> SELECT * FROM s_item;
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
......................................................................................................................................................
B-22
Oracle Forms Developer: Build Internet Applications I
S_ITEM Data
.....................................................................................................................................................
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
62 rows selected.
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
B-23
Null?
-----NOT NULL
NOT NULL
Datatype
--------------------NUMBER(7)
NUMBER(7)
DATE
DATE
NUMBER(7)
NUMBER(11,2)
VARCHAR2(6)
VARCHAR2(1)
DATE_ORDE
DATE_SHIPSALES_REP_IDTOTAL PAYMEN
ORDER_F
--- -----------
---------
----------------------------------
------
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.6
8335
377
32430
2722.24
15634
142171
149570
1020935
1539.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.
......................................................................................................................................................
B-24
Oracle Forms Developer: Build Internet Applications I
S_PRODUCT Description
.....................................................................................................................................................
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,2)
VARCHAR2(25)
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
B-25
S_PRODUCT Data
SQL> SELECT * FROM s_product;
ID
---IMAGE_ID
-------10011
1001
NAME
SHORT_DESC
LONGTEXT_ID
-----------------------------------SUGGESTED_WHLSL_PRICEWHLSL_UNITS
-------------------------------Boot
Beginners ski boot 518
150
10012
1002
10013
1003
10021
1011
10022
1012
10023
1013
20106
520
530
20108
20201
708
......................................................................................................................................................
B-26
Oracle Forms Developer: Build Internet Applications I
S_PRODUCT Data
.....................................................................................................................................................
1019
940
1286
1368
928
929
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
B-27
NAME
SHORT_DESC
LONGTEXT_ID
--------------------------------------SUGGESTED_WHLSL_PRICEWHLSL_UNITS
-------------------------------Alexeyer ProStraight bar
928
Lifting Bar
65
40422
1382
41010
41020
41050
41080
41100
50169
1119
929
676
......................................................................................................................................................
B-28
Oracle Forms Developer: Build Internet Applications I
S_PRODUCT Data
.....................................................................................................................................................
925
926
1037
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
B-29
Datatype
---------------NUMBER(7)
VARCHAR2(50)
NAME
-------------------------North America
South America
Africa / Middle East
Asia
Europe
......................................................................................................................................................
B-30
Oracle Forms Developer: Build Internet Applications I
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
B-31
Type
---------------NUMBER(7)
VARCHAR2(25)
VARCHAR2(25)
VARCHAR2(8)
DATE
NUMBER(7)
VARCHAR2(25)
DEPT_TYPE
NUMBER(11,2)
NUMBER(4,2)
emp_type_RefCol
Name
Null?
-------------------- ------------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,2)
dept_type
--------------------------------ID
NAME
REGION_ID
---------------NUMBER
VARCHAR2(25)
NUMBER(7)
......................................................................................................................................................
B-32
Oracle Forms Developer: Build Internet Applications I
Tables
oo_emp_Table_ObjCol
Name
Null?
Type
-------------------- ---------------------------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,2)
COMMISSION_PCT
NUMBER(4,2)
ID
LAST_NAME
FIRST_NAME
USERID
--------- ----------------------------------- -------START_DAT MANAGER_ID TITLE
--------- ---------- ------------------------DEPT_ID(ID, NAME, REGION_ID)
----------------------------------------------------------SALARY COMMISSION_PCT
---------- -------------1Velasquez
Carmencvelasqu
03-MAR-90
President
DEPT_TYPE(50, Administration, 1)
2500
2Ngao
08-MAR-90
DEPT_TYPE(41, Operations, 1)
1450
LaDorislngao
1 VP Operations
3Nagayama
17-JUN-91
DEPT_TYPE(31, Sales, 1)
1400
ID
LAST_NAME
Midorimnagayam
1 VP Sales
FIRST_NAME
USERID
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
B-33
......................................................................................................................................................
B-34
Oracle Forms Developer: Build Internet Applications I
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
B-35
gsmith
18
Nozaki
Akira
09-FEB-91
7 Stock Clerk
DEPT_TYPE(42, Operations, 2)
1200
anozaki
19
Patel
Vikram
06-AUG-91
7 Stock Clerk
DEPT_TYPE(42, Operations, 2)
795
vpatel
20
Newman
Chad
21-JUL-91
8 Stock Clerk
DEPT_TYPE(43, Operations, 3)
750
cnewman
21
Markarian
Alexander
amarkari
26-MAY-91
8 Stock Clerk
DEPT_TYPE(43, Operations, 3)
850
ID
LAST_NAME
FIRST_NAME
USERID
---------- ------------------------------ -------START_DAT MANAGER_ID
TITLE
--------- ----------------------------------
......................................................................................................................................................
B-36
Oracle Forms Developer: Build Internet Applications I
rpatel
24
Dancs
Bela
17-MAR-91
10 Stock Clerk
DEPT_TYPE(45, Operations, 5)
860
bdancs
25 Schwartz
Sylvie
09-MAY-91
10 Stock Clerk
DEPT_TYPE(45, Operations, 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,2)
Type
---------------NUMBER(7)
VARCHAR2(25)
VARCHAR2(25)
VARCHAR2(8)
DATE
NUMBER(7)
VARCHAR2(25)
REF OF DEPT_TYPE
NUMBER(11,2)
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
B-37
ID
LAST_NAME
FIRST_NAME
USERID
---------- --------------------------------- -------START_DAT MANAGER_ID TITLE
--------- ---------- ------------------------DEPT_ID(ID, NAME, REGION_ID)
-----------------------------------------------------------SALARY COMMISSION_PCT
---------- -------------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
......................................................................................................................................................
B-38
Oracle Forms Developer: Build Internet Applications I
ID
LAST_NAME
FIRST_NAME
USERID
---------- ------------------ --------------- -------START_DAT MANAGER_ID TITLE
--------- ---------- ------------------------DEPT_ID(ID, NAME, REGION_ID)
-----------------------------------------------------------SALARY COMMISSION_PCT
---------- -------------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
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
B-39
ID
LAST_NAME
FIRST_NAME
USERID
---------- ------------------ --------------- -------START_DAT MANAGER_ID TITLE
--------- ---------- ------------------------DEPT_ID(ID, NAME, 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
......................................................................................................................................................
B-40
Oracle Forms Developer: Build Internet Applications I
ID
LAST_NAME
FIRST_NAME
USERID
---------- --------------------------------- -------START_DAT MANAGER_ID TITLE
--------- ---------- ------------------------DEPT_ID(ID, NAME, REGION_ID)
-----------------------------------------------------------SALARY COMMISSION_PCT
---------- -------------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
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
B-41
ID
LAST_NAME
FIRST_NAME
USERID
---------- --------------------------------- -------START_DAT MANAGER_ID TITLE
--------- ---------- ------------------------DEPT_ID(ID, NAME, 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
......................................................................................................................................................
B-42
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,2)
NUMBER(4,2)
ID
LAST_NAME
FIRST_NAME
USERID
---------- --------------------------------- -------START_DAT MANAGER_ID TITLE
--------- ---------- ------------------------DEPT_ID(ID, NAME, REGION_ID)
-----------------------------------------------------------SALARY COMMISSION_PCT
---------- -------------1
Velasquez
Carmen
cvelasqu
03-MAR-90 President
DEPT_TYPE(50, Administration, 1)
2500
2 Ngao
LaDoris
08-MAR-90 1 VP Operations
DEPT_TYPE(41, Operations, 1)
1450
lngao
3 Nagayama
Midori
17-JUN-91
1 VP Sales
DEPT_TYPE(31, Sales, 1)
1400
mnagayam
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
B-43
ID
LAST_NAME
FIRST_NAME
USERID
---------- --------------------------------- -------START_DAT MANAGER_ID TITLE
--------- ---------- ------------------------DEPT_ID(ID, NAME, REGION_ID)
-----------------------------------------------------------SALARY COMMISSION_PCT
---------- -------------4
Quick-To-See
Mark
mquickto
07-APR-90 1 VP Finance
DEPT_TYPE(10, Finance, 1)
1450
5 Ropeburn
Audry
aropebur
04-MAR-90
1 VP Administration
DEPT_TYPE(50, Administration, 1)
1550
6 Urguhart
Molly
murguhar
18-JAN-91
2 Warehouse Manager
DEPT_TYPE(41, Operations, 1)
1200
7 Menchu
Roberta
rmenchu
14-MAY-90
2 Warehouse Manager
DEPT_TYPE(42, Operations, 2)
1250
8 Biri
Ben
bbiri
07-APR-90
2 Warehouse Manager
DEPT_TYPE(43, Operations, 3)
1100
9 Catchpole
Antoinette
acatchpo
09-FEB-92
2 Warehouse Manager
DEPT_TYPE(44, Operations, 4)
1300
......................................................................................................................................................
B-44
Oracle Forms Developer: Build Internet Applications I
ID
LAST_NAME
FIRST_NAME
USERID
---------- --------------------------------- -------START_DAT MANAGER_ID TITLE
--------- ---------- ------------------------DEPT_ID(ID, NAME, REGION_ID)
-----------------------------------------------------------SALARY COMMISSION_PCT
---------- -------------10
Havel
Marta
mhavel
27-FEB-91
2 Warehouse Manager
DEPT_TYPE(45, Operations, 5)
1307
11 Magee
Colin
cmagee
14-MAY-90
3 Sales Representative
DEPT_TYPE(31, Sales, 1)
1400
10
12 Giljum
Henry
hgiljum
18-JAN-92
3 Sales Representative
DEPT_TYPE(32, Sales, 2)
1490
13
13 Sedeghi
Yasmin
ysedeghi
18-FEB-91
3 Sales Representative
DEPT_TYPE(33, Sales, 3)
1515
10
14 Nguyen
Mai
mnguyen
22-JAN-92
3 Sales Representative
DEPT_TYPE(34, Sales, 4)
1525
15
15 Dumas
Andre
adumas
09-OCT-91
3 Sales Representative
DEPT_TYPE(35, Sales, 5)
1450
18
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
B-45
ID
LAST_NAME
FIRST_NAME
USERID
---------- --------------------------------- -------START_DAT MANAGER_ID TITLE
--------- ---------- ------------------------DEPT_ID(ID, NAME, REGION_ID)
-----------------------------------------------------------SALARY COMMISSION_PCT
---------- -------------16 Maduro
Elena
emaduro
07-FEB-92
6 Stock Clerk
DEPT_TYPE(41, Operations, 1)
1400
17 Smith
George
08-MAR-90
6 Stock Clerk
DEPT_TYPE(41, Operations, 1)
940
gsmith
18 Nozaki
Akira
09-FEB-91
7 Stock Clerk
DEPT_TYPE(42, Operations, 2)
1200
anozaki
19 Patel
Vikram
06-AUG-91
7 Stock Clerk
DEPT_TYPE(42, Operations, 2)
795
vpatel
20 Newman
Chad
21-JUL-91
8 Stock Clerk
DEPT_TYPE(43, Operations, 3)
750
cnewman
21 Markarian
Alexander
26-MAY-91
8 Stock Clerk
DEPT_TYPE(43, Operations, 3)
850
amarkari
......................................................................................................................................................
B-46
Oracle Forms Developer: Build Internet Applications I
ID
LAST_NAME
FIRST_NAME
USERID
---------- --------------------------------- -------START_DAT MANAGER_ID TITLE
--------- ---------- ------------------------DEPT_ID(ID, NAME, REGION_ID)
-----------------------------------------------------------SALARY COMMISSION_PCT
---------- -------------22 Chang
Eddie
echang
30-NOV-90
9 Stock Clerk
DEPT_TYPE(44, Operations, 4)
800
23 Patel
Radha
17-OCT-90
9 Stock Clerk
DEPT_TYPE(34, Sales, 4)
795
rpatel
24 Dancs
Bela
17-MAR-91
10 Stock Clerk
DEPT_TYPE(45, Operations, 5)
860
bdancs
25 Schwartz
Sylvie
09-MAY-91
10 Stock Clerk
DEPT_TYPE(45, Operations, 5)
1100
sschwart
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
B-47
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)
NUMBER(4,2)
......................................................................................................................................................
B-48
Oracle Forms Developer: Build Internet Applications I
ID
LAST_NAME
FIRST_NAME
USERID
---------- --------------------------------- -------START_DAT MANAGER_ID TITLE
--------- ---------- ------------------------DEPT_ID(ID, NAME, REGION_ID)
-----------------------------------------------------------SALARY COMMISSION_PCT
---------- -------------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
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
B-49
ID
LAST_NAME
FIRST_NAME
USERID
---------- --------------------------------- -------START_DAT MANAGER_ID TITLE
--------- ---------- ------------------------DEPT_ID(ID, NAME, REGION_ID)
-----------------------------------------------------------SALARY COMMISSION_PCT
---------- -------------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
......................................................................................................................................................
B-50
Oracle Forms Developer: Build Internet Applications I
ID
LAST_NAME
FIRST_NAME
USERID
---------- --------------------------------- -------START_DAT MANAGER_ID TITLE
--------- ---------- ------------------------DEPT_ID(ID, NAME, 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
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
B-51
ID
LAST_NAME
FIRST_NAME
USERID
---------- --------------------------------- -------START_DAT MANAGER_ID TITLE
--------- ---------- ------------------------DEPT_ID(ID, NAME, REGION_ID)
-----------------------------------------------------------SALARY COMMISSION_PCT
---------- -------------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
......................................................................................................................................................
B-52
Oracle Forms Developer: Build Internet Applications I
ID
LAST_NAME
FIRST_NAME
USERID
---------- --------------------------------- -------START_DAT MANAGER_ID TITLE
--------- ---------- ------------------------DEPT_ID(ID, NAME, 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
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
B-53
......................................................................................................................................................
B-54
Oracle Forms Developer: Build Internet Applications I
C
................................
Appendix
C: Oracle Rdb Overview
......................................................................................................................................................
......................................................................................................................................................
C-2
Oracle Forms Developer: Build Internet Applications I
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
C-3
Appendix
C: Oracle Rdb Overview
......................................................................................................................................................
Other Information
Oracle Rdb Education Oracle University offers a comprehensive series
of Oracle Rdb courses. 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, schedules, and enrollment information, go to the Oracle
corporate Web site:
http://www.oracle.com
or call 1-800-633-0575.
Oracle Rdb Product Information TThe Oracle Rdb Web site:
http://www.oracle.com/rdb
is the resource for finding out the latest news on the product and its features. 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, send e-mail, including your name,
address, and company, to:
infordb@us.oracle.com
Specify that you would like to receive the free Oracle Rdb CD-ROM.
......................................................................................................................................................
C-4
Oracle Forms Developer: Build Internet Applications I
D
................................
Appendix
D: Locking in Form Builder
......................................................................................................................................................
Objectives
......................................................................................................................................................
D-2
Oracle Forms Developer: Build Internet Applications I
......................................................................................................................................................
Overview
Locking is an important consideration in multiuser applications that access
the database. This lesson shows you how Forms handles locking and how
you can design forms with these mechanisms in mind.
Instructor Note
Topic
Lecture
Timing
17 minutes
Total
17 minutes
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
D-3
Appendix
D: Locking in Form Builder
......................................................................................................................................................
Locking
Insert, update, or delete
Row in (X)
Row in (X)
Query
Table in (RX)
......................................................................................................................................................
D-4
Oracle Forms Developer: Build Internet Applications I
Locking
......................................................................................................................................................
Locking
In database applications, locking maintains the consistency and integrity of
the data, where several users are potentially accessing the same tables and
rows. 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. Here is a reminder
of the main points:
Oracle8 uses row-level locking to protect data that is being inserted,
updated, or deleted.
Queries do not prevent other database sessions from performing data
manipulation. This also applies to the reverse situation.
Locks are released at the end of a database transaction (following a
rollback or commit).
A session issues locks to prevent other sessions from performing certain
actions on a row or table. The main Oracle8 locks that affect Form Builder
applications are the following:
Lock Type
Exclusive (X) row lock
Row Share (RS) 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 . . . FOR UPDATE
Allows write operations on a table from several
sessions simultaneously, but prevents (X) lock on
entire table; usually occurs because of a DML
operation
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
D-5
Appendix
D: Locking in Form Builder
......................................................................................................................................................
Insert record
No locks
Update record
RS on table
Delete record
RS on table
Action
Save
RX on above
......................................................................................................................................................
D-6
Oracle Forms Developer: Build Internet Applications I
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.)
*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, so that other users cannot perform
conflicting actions on these rows until the locking form has completed
(Saved) its transaction.
What Happens When Users Compete for the Same Row?
Users who are only querying data are not affected here. If two users are
attempting to update or delete the same record, then integrity is protected by
the locking that occurs automatically at row level.
Form Builder also keeps each user informed of these events through
messages and alerts when:
A row is already locked by another user. The user has the option of
waiting or trying again later.
Another user has committed changes since a record was queried. The
user must requery before the users own change can be applied.
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
D-7
Appendix
D: Locking in Form Builder
......................................................................................................................................................
User A: Step 1
User B: Step 2
......................................................................................................................................................
D-8
Oracle Forms Developer: Build Internet Applications I
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
D-9
Appendix
D: Locking in Form Builder
......................................................................................................................................................
User A: Step 3
User B: Step 4
......................................................................................................................................................
D-10
Oracle Forms Developer: Build Internet Applications I
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
D-11
Appendix
D: Locking in Form Builder
......................................................................................................................................................
Achieved by:
......................................................................................................................................................
D-12
Oracle Forms Developer: Build Internet Applications I
Locking in Triggers
......................................................................................................................................................
Locking in Triggers
In addition to the default locking described earlier, database locks can occur
in Forms applications because of actions that you include in triggers. These
can be:
SQL data manipulation language (DML): Sometimes you may need to
perform INSERT, UPDATE, and DELETE statements, which add to
those that Forms does during the saving process (posting and
committing). These trigger SQL commands cause implicit locks on the
tables and rows that they affect.
SQL locking statements: You can explicitly issue locks from a trigger
through the SELECT . . . FOR UPDATE statement. The LOCK TABLE
statement is also allowed, though rarely necessary.
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).
To keep locking duration to a minimum, DML statements should be used
only in transactional triggers. These triggers fire during the process of
applying and saving the users changes, just before the end of a transaction
when locks are released.
Locking by DML Statements
If you include DML statements in transactional triggers, 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, when all
changes have been applied, it is advantageous to code DML statements as
efficiently as possible, so that their actions are completed quickly.
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
D-13
Appendix
D: Locking in Form Builder
......................................................................................................................................................
ENTER_QUERY (FOR_UPDATE)
EXECUTE_QUERY (FOR_UPDATE)
......................................................................................................................................................
D-14
Oracle Forms Developer: Build Internet Applications I
Locking in Triggers
......................................................................................................................................................
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
D-15
Appendix
D: Locking in Form Builder
......................................................................................................................................................
On-Lock Trigger
Example
IF USER = MANAGER THEN
LOCK_RECORD;
ELSE
MESSAGE(You are not authorized to change records
here);
RAISE form_trigger_failure;
END IF;
......................................................................................................................................................
D-16
Oracle Forms Developer: Build Internet Applications I
Locking in Triggers
......................................................................................................................................................
On-Lock Trigger
This block-level trigger replaces the default locking that Forms normally
carries out, typically when the user updates or deletes a record in a base table
block. The trigger fires before the change to the record is displayed. On
failure, the input focus is set on the current item.
Use this trigger to:
Bypass locking on a single-user system, hence speeding processing
Conditionally lock the record or fail the trigger (Failing the trigger
effectively fails the users action.)
Handle locking when directly accessing non-Oracle data sources
If this trigger succeeds, but its action does not lock the record, then the row
remains unlocked after the users update or delete operation. Use the
LOCK_RECORD built-in within the trigger if locking is not to be bypassed.
Example
The following On-Lock trigger on the block Stock only permits the user
MANAGER to lock records for update or delete.
IF USER = MANAGER THEN
LOCK_RECORD;
IF NOT FORM_SUCCESS THEN
RAISE form_trigger_failure;
END IF;
ELSE
MESSAGE(You are not authorized to change records here);
RAISE form_trigger_failure;
END IF;
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
D-17
Appendix
D: Locking in Form Builder
......................................................................................................................................................
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
......................................................................................................................................................
D-18
Oracle Forms Developer: Build Internet Applications I
Summary
......................................................................................................................................................
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
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
D-19
Appendix
D: Locking in Form Builder
......................................................................................................................................................
......................................................................................................................................................
D-20
Oracle Forms Developer: Build Internet Applications I
E
................................
Appendix
E: Oracle8 Object Features
......................................................................................................................................................
Objectives
......................................................................................................................................................
E-2
Oracle Forms Developer: Build Internet Applications I
Overview
......................................................................................................................................................
Overview
Introduction
In this lesson, you will review certain object features of Oracle8. This lesson also
explains how objects are displayed in the Object Navigator.
Objectives
After completing this lesson, you should be able to do the following:
Describe the Oracle8 scalar datatypes
Describe object types and objects
Describe object tables, object columns, and object views
Describe the INSTEAD-OF triggers
Describe object REFs
Identify the display of objects in the Object Navigator
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
E-3
Appendix
E: Oracle8 Object Features
......................................................................................................................................................
NCHAR
NVARCHAR2
FLOAT
NLS types
......................................................................................................................................................
E-4
Oracle Forms Developer: Build Internet Applications I
Oracle8 Datatypes
......................................................................................................................................................
Oracle8 Datatypes
Scalar Datatypes
NCHAR stores fixed-length (blank-padded if necessary) NLS (National
Language Support) character data. How the data is represented internally
depends on the national character set, which might use a fixed-width
encoding such as US7ASCII or a variable-width encoding such as
JA16SJIS.
NVARCHAR2 stores variable-length NLS character data. How the data
is represented internally depends on the national character set, which
might use a fixed-width encoding such as WE8EBCDIC37C or a
variable-width encoding such as JA16DBCS.
FLOAT is a subtype of NUMBER. However, you cannot specify a scale
for FLOAT variables. You can only specify a binary precision, which is
the total number of binary digits.
There is no change to the way scalar datatypes are displayed in Oracle Forms
Developer and Oracle Reports Developer. The datatypes are automatically converted
to existing Forms and Reports item datatypes.
NLS Types
Oracle8 offers extended NLS, including national character sets and the datatypes
NCHAR and NVARCHAR2, which store NLS data. With NLS, number and date
formats adapt automatically to the language conventions specified for a user session.
Users around the world can interact with the Oracle server in their native languages.
NLS is discussed in Oracle8 Server Reference Manual.
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
E-5
Appendix
E: Oracle8 Object Features
......................................................................................................................................................
Object Types
Attributes
......................................................................................................................................................
E-6
Oracle Forms Developer: Build Internet Applications I
Oracle8 Datatypes
......................................................................................................................................................
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
E-9
Appendix
E: Oracle8 Object Features
......................................................................................................................................................
Object Types
Attributes
Ship
ORDER
Check
status
po_no
custinfo
line_items
amount
Cancel
Hold
Methods
Copyright Oracle Corporation, 2000. All rights reserved.
......................................................................................................................................................
E-8
Oracle Forms Developer: Build Internet Applications I
Oracle8 Datatypes
......................................................................................................................................................
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
E-9
Appendix
E: Oracle8 Object Features
......................................................................................................................................................
Object Tables
Instructor Note
At this point, review the fact that object types are not themselves objects. They are
only blueprints for objects.
The term object can be confusing because Oracle uses the term to refer to constructs
within the databasefor example, tables, views, procedures, and so on. This is a
completely different usage. Make certain that your students are aware of the
overloading of this term.
......................................................................................................................................................
E-10
Oracle Forms Developer: Build Internet Applications I
SQL and PL/SQL treat object tables very similarly to relational tables, with the
attribute of the object corresponding to the columns of the table. But there are
significant differences. The most important difference is that rows in an object table
are assigned object IDs (OIDs) and can be referenced using a REF type.
Note: REF types are reviewed later.
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
E-11
Appendix
E: Oracle8 Object Features
......................................................................................................................................................
Object Columns
......................................................................................................................................................
E-12
Oracle Forms Developer: Build Internet Applications I
Object Columns
Another construct that can be based on an object type is an object column in a
relational table. Here is an example of a relational table creation statement with an
object column:
CREATE TABLE o_customer (
custid
NUMBER (6) NOT NULL,
name
VARCHAR2 (45),
repid
NUMBER (4) NOT NULL,
creditlimit NUMBER (9,2),
address
address_type,
phone
phone_type);
In the object table, the rows of a table are objects. In a relational table with an object
column, the column is an object. The table will usually have standard columns, as well
as one or more object columns.
Object columns are not assigned object IDs (OIDs) and therefore cannot be referenced
using object REF values.
Note: Object REFs are reviewed later in this section.
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
E-13
Appendix
E: Oracle8 Object Features
......................................................................................................................................................
Object Views
Object-oriented
application
Object
view
Relational
table
......................................................................................................................................................
E-14
Oracle Forms Developer: Build Internet Applications I
Object Views
Often, the most difficult part of adopting a new technology is the conversion process
itself. For example, a large enterprise might have several applications accessing the
same data stored in relational tables. If such an enterprise decided to start using objectrelational technology, the enterprise would not convert all of the applications at once.
It would convert the applications one at a time.
That presents a problem. The applications that have been converted need the data
stored as objects, whereas the applications that have not been converted need the data
stored in relational tables.
This dilemma is addressed by object views. Like all views, an object view transforms
the way a table appears to a user, without changing the actual structure of the table.
Object views make relational tables look like object tables. 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. During the
conversion process, the object-relational applications can operate against the object
view; the relational applications can continue to operate against the relational tables.
Objects accessed through object views are assigned object IDs (OIDs), and can be
referenced using object REFs.
Note: Object REFs are reviewed later in this section.
Here is an example of an object view creation statement:
CREATE VIEW emp_view OF emp_type
WITH OBJECT OID (eno)
AS
SELECT
e.empno, e.ename, e.sal, e.job
FROM
emp e;
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
E-15
Appendix
E: Oracle8 Object Features
......................................................................................................................................................
INSTEAD-OF Triggers
DECLARE
BEGIN
EXCEPTION
END;
Nonupdatable
view
INSTEAD-OF
Trigger
......................................................................................................................................................
E-16
Oracle Forms Developer: Build Internet Applications I
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
E-17
Appendix
E: Oracle8 Object Features
......................................................................................................................................................
......................................................................................................................................................
E-18
Oracle Forms Developer: Build Internet Applications I
Referencing Objects
......................................................................................................................................................
Referencing Objects
Introduction
In relational databases, primary key values are used to uniquely identify records. In
object-relational databases, OIDs provide an alternative method.
When a row in an object table or object view is created, it is automatically assigned a
unique identifier called an object ID (OID).
Object REFs
With relational tables, you can associate two records by storing the primary key of one
record in one of the columns (the foreign key column) of another.
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 objects by storing the OID of one object in an attribute of
another. The stored copy of the OID then becomes a pointer, or reference (REF), to the
original object. The attribute or column that holds the OID is of datatype REF.
Note: Object columns are not assigned OIDs and cannot be pointed to by a REF.
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,
ename
VARCHAR2(10),
job
VARCHAR2(10),
mgr
NUMBER(4),
hiredate DATE,
sal
NUMBER(7,2),
comm
NUMBER(7,2),
dept
REF dept_type SCOPE IS o_dept) ;
Note: The REF is scoped here to restrict the reference to a single table, O_DEPT. The
object itself is not stored in the table, only the OID value for the object.
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
E-19
Appendix
E: Oracle8 Object Features
......................................................................................................................................................
......................................................................................................................................................
E-20
Oracle Forms Developer: Build Internet Applications I
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
E-21
Appendix
E: Oracle8 Object Features
......................................................................................................................................................
......................................................................................................................................................
E-22
Oracle Forms Developer: Build Internet Applications I
Object Tables
Object tables are displayed like relational tables, with the attributes of the object
displayed like columns in a relational table. Also, the object table type name is
displayed in parentheses after the name of the object table.
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.
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
E-23
Appendix
E: Oracle8 Object Features
......................................................................................................................................................
......................................................................................................................................................
E-24
Oracle Forms Developer: Build Internet Applications I
Object Views
Object views are displayed like any other view, except that the object type on which
they are based is written in parentheses after the view name.
INSTEAD-OF Triggers INSTEAD-OF database triggers can now be created
through the trigger creation dialog box, just like any other database trigger.
INSTEAD-OF INSERT, UPDATE, and DELETE triggers allow you to directly insert,
update, and delete against object views. They can also be used with any other type of
view that does not allow direct DML.
When a view has an INSTEAD-OF trigger, the code in the trigger is executed in place
of the triggering DML code.
Reference For more information about INSTEAD-OF triggers, see Oracle8 Server
SQL Reference Manual and Oracle8 Concepts Manual.
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
E-25
Appendix
E: Oracle8 Object Features
......................................................................................................................................................
......................................................................................................................................................
E-26
Oracle Forms Developer: Build Internet Applications I
Object REFs
Object types that contain attributes of type REF, and relational tables that have
columns of type REF, display the keyword REF before the name of the object type that
is being referenced.
The attributes of the referenced object type are displayed indented under the column or
attribute.
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
E-27
Appendix
E: Oracle8 Object Features
......................................................................................................................................................
Summary
Summary
......................................................................................................................................................
E-28
Oracle Forms Developer: Build Internet Applications I
Summary
......................................................................................................................................................
Summary
Oracle8 Datatypes
Oracle8 introduced three scalar datatypes and composite datatypes such as object
types.
Objects
Three kinds of objects are object tables, object columns, and object views.
INSTEAD-OF triggers allow DML on object views.
Object REFs store the object identifier of certain types of objects.
Oracle8 Objects in the Object Navigator
The Object Navigator can display certain types of objects.
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
E-29
Appendix
E: Oracle8 Object Features
......................................................................................................................................................
......................................................................................................................................................
E-30
Oracle Forms Developer: Build Internet Applications I
F
................................
Appendix
F: Using the Layout Editor
......................................................................................................................................................
Objectives
......................................................................................................................................................
F-2
Oracle Forms Developer: Build Internet Applications I
Overview
......................................................................................................................................................
Overview
Introduction
In this lesson, you learn the graphical features of the Layout Editor common to Oracle
Forms Developer and Oracle Reports Developer. This will help you control the visual
arrangement and appearance of objects in your applications.
Objectives
After completing this lesson, 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
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
F-3
Appendix
F: 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
Layout types:
Canvases in Forms
Report layouts
......................................................................................................................................................
F-4
Oracle Forms Developer: Build Internet Applications I
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
F-5
Appendix
F: Using the Layout Editor
......................................................................................................................................................
Instructor Note
Demonstration:
Accessing through the Tools menu
Access through the Navigator
Closing and minimizing the Layout Editor window
Reopening the Layout Editor
......................................................................................................................................................
F-6
Oracle Forms Developer: Build Internet Applications I
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
F-7
Appendix
F: Using the Layout Editor
......................................................................................................................................................
4
Copyright Oracle Corporation, 2000. All rights reserved.
......................................................................................................................................................
F-8
Oracle Forms Developer: Build Internet Applications I
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
F-9
Appendix
F: Using the Layout Editor
......................................................................................................................................................
Tool Palette
1
2
3
4
5
6
7
8
9
10
11
12
13
Select
Rotate
Magnify
Reshape
Rectangle
10
Line
Ellipse
11
Arc
Polygon
12
Polyline
Rounded rectangle
13
Freehand
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, with text over multiple lines
Double-clicking the palette tool to retain selection
......................................................................................................................................................
F-10
Oracle Forms Developer: Build Internet Applications I
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
F-11
Appendix
F: Using the Layout Editor
......................................................................................................................................................
Selecting Objects
Manipulating Objects
Expand/contract
in one direction
Expand/contract
diagonally
Copyright Oracle Corporation, 2000. All rights reserved.
......................................................................................................................................................
F-12
Oracle Forms Developer: Build Internet Applications I
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
F-13
Appendix
F: Using the Layout Editor
......................................................................................................................................................
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, 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
......................................................................................................................................................
F-14
Oracle Forms Developer: Build Internet Applications I
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
F-15
Appendix
F: Using the Layout Editor
......................................................................................................................................................
Instructor Note
Create your own objects to do the following:
Place some objects into a group, and then show how they can be
manipulated as one. Point out the single set of handles.
Point out or mention the other grouping options (Group Operations
menu).
Demonstrate zooming in/out using the Magnify tool.
Show Undo/Redo of a Layout Editor operation from the Edit menu.
......................................................................................................................................................
F-16
Oracle Forms Developer: Build Internet Applications I
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
F-17
Appendix
F: Using the Layout Editor
......................................................................................................................................................
Format Menu
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
......................................................................................................................................................
F-18
Oracle Forms Developer: Build Internet Applications I
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
F-19
Appendix
F: Using the Layout Editor
......................................................................................................................................................
2
3
4
Sample window
Fill color/pattern
Line color
Text color
......................................................................................................................................................
F-20
Oracle Forms Developer: Build Internet Applications I
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
F-21
Appendix
F: Using the Layout Editor
......................................................................................................................................................
2
3
4
Sample window
Fill color/pattern
Line color
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
......................................................................................................................................................
F-22
Oracle Forms Developer: Build Internet Applications I
Coloring Text
1 Select the textual objects whose color you want to change in the layout.
2 Select the Text Color tool. The color palette appears, showing the
available colors.
3 Select a color from those shown (click the appropriate square).
4 Notice that the selected objects on the layout have adopted the chosen
text color. Also, the sample area in the vertical toolbar shows a T with
the selected color, and this color appears next to the Text Color tool. This
indicates the current text color setting.
Altering the Color Palette
By selecting Format>Layout Options>Color Palette from the menu, you can edit
the color palette that is presented when selecting colors. This option is available only
when the builder option Color Palette Mode is set to Editable. Changes to the color
palette are saved with the current module.
Note: Modifications to the color palette will not be apparent until you close the
document and reopen it.
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
F-23
Appendix
F: Using the Layout Editor
......................................................................................................................................................
Importing Images
Instructor Note
Show how to import an image from the file system, pointing out the various file
formats that are supported. Recommend using summitlo.tif.
Show that boilerplate images can be moved and resized on the layout.
......................................................................................................................................................
F-24
Oracle Forms Developer: Build Internet Applications I
Description
Where to import from
File to be imported
Image format (BMP, TIFF, PCX, PICT, GIF, CALS,
RAS, Oracle Format, and PCD [Kodak Photo CD])
Range from Excellent to Poor. This is a trade-off
between image resolution and memory required.
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
F-25
Appendix
F: Using the Layout Editor
......................................................................................................................................................
Summary
There are color palette tools for fill area, lines, and
text.
View, Arrange, and Format menus are available for
layout.
Objects can be grouped for operations.
You can import images and drawings by using
File>Import.
Copyright Oracle Corporation, 2000. All rights reserved.
......................................................................................................................................................
F-26
Oracle Forms Developer: Build Internet Applications I
Summary
......................................................................................................................................................
Summary
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
F-27
Appendix
F: Using the Layout Editor
......................................................................................................................................................
......................................................................................................................................................
F-28
Oracle Forms Developer: Build Internet Applications I
G
................................
Introduction to Query
Builder
......................................................................................................................................................
G-2
Oracle Forms Developer: Build Internet Applications I
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
G-3
......................................................................................................................................................
G-4
Oracle Forms Developer: Build Internet Applications I
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
G-5
1
2
3
Toolbar
Conditions panel
Datasource panel
......................................................................................................................................................
G-6
Oracle Forms Developer: Build Internet Applications I
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
G-7
......................................................................................................................................................
G-8
Oracle Forms Developer: Build Internet Applications I
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
G-9
Datasource Components
3
7
8
4
Copyright Oracle Corporation, 2000. All rights reserved.
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
Datasource Components
.....................................................................................................................................................
Datasource Components
Tables
A table that has been included in a query is referred to as a datasource. It is displayed
as a rectangular graphic in the Datasource panel of the Query window. The top part of
the rectangle contains the table name and an icon representing its type.
Type
Table
View
Synonym
Alias
Description
Stores data in the database.
Acts like a table when you execute a query, but is really a pointer to either
a subset of a table, a combination of tables, or a join of two or more tables.
Another name for an object. Sometimes table names can be rather cryptic,
such as emp_em_con_tbl. You can create a synonym that simply calls this
table Contracts.
Query Builder uses an alias name for a table when the table is used more
than once, mostly with self-joins (you can also rename a table).
Columns
The body of the rectangle contains column names listed vertically. To the right of the
column name is an icon representing the datatype.
Columns also provide additional information.
Primary keys are displayed in bold.
Foreign keys are displayed in italics.
Recursive relationships are indicated by a self-relationship icon.
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
G-11
Refining a Query
......................................................................................................................................................
G-12
Oracle Forms Developer: Build Internet Applications I
Refining a Query
.....................................................................................................................................................
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, 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, double-click the table heading.
Changing Column Position in a Query
By default, Query Builder places columns in the order in which you select them. You
can resequence them by selecting the Column Sequence tool.
The Column Sequence dialog box appears. Column names are shown in the Displayed
Columns list in order of their appearance in the query. Drag any column to a new
position.
Note: You can also use the Column Sequence dialog box to add columns to or remove
them from a query.
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
G-13
Sorting Data
......................................................................................................................................................
G-14
Oracle Forms Developer: Build Internet Applications I
Refining a Query
.....................................................................................................................................................
Sorting Data
By default, a query returns the data in no specific order. To sort the data, you must add
an ORDER BY clause to the query.
How to Add an ORDER BY Clause to a Query
1 Select the Sort tool. The Sort dialog box appears.
2 Select the column you want to sort from the Available Columns list.
3 Select Copy.
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.
Note: You can sort by more than one column. Query Builder sorts according to the
order in which columns appear in the Sorted Columns list.
4 You can change the sorting order by selecting the column name in the Sorted
Columns list and selecting the desired option button.
5 Select OK to close the dialog box.
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
G-15
......................................................................................................................................................
G-16
Oracle Forms Developer: Build Internet Applications I
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
G-17
......................................................................................................................................................
G-18
Oracle Forms Developer: Build Internet Applications I
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
G-19
Viewing Comments
......................................................................................................................................................
G-20
Oracle Forms Developer: Build Internet Applications I
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
G-21
......................................................................................................................................................
G-22
Oracle Forms Developer: Build Internet Applications I
Relationships
.....................................................................................................................................................
Relationships
To combine data from multiple tables into one query, Query Builder enables you to
search for relationships between tables and to create user-defined relationships if they
do not exist. Additionally, you can activate or deactivate relationships to suit your
needs.
How to Find and Include Related Tables
1 Select the table in the Datasource panel.
2 Choose the Select Related Tables tool.
A list of tables that have relationships defined with the selected table appears.
3 Select the table name and click Include, or simply double-click the table name.
The selected table appears in the Datasource panel. Relationships between the
tables are identified by relationship lines, drawn from the primary keys in one table
to the foreign keys in another.
4 Click Close to close the dialog box.
Once you have included the table, you can retrieve its columns.
Note: When you select a foreign key column before selecting related tables, only the
table to which the foreign key refers appears in the Select Related Tables dialog box.
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
G-23
......................................................................................................................................................
G-24
Oracle Forms Developer: Build Internet Applications I
Relationships
.....................................................................................................................................................
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
G-25
Unmatched Rows
......................................................................................................................................................
G-26
Oracle Forms Developer: Build Internet Applications I
Relationships
.....................................................................................................................................................
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
G-27
Conditions
......................................................................................................................................................
G-28
Oracle Forms Developer: Build Internet Applications I
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
G-29
Operators
Arithmetic
Perform calculations on numeric and date columns
Examples: +, -, x, /
Logical
Combine conditions
Examples: AND, OR, NOT
Comparison
Compare one expression with another
Examples: =, <>, <, IN, IS NULL,
BETWEEN ... AND
......................................................................................................................................................
G-30
Oracle Forms Developer: Build Internet Applications I
Operators
.....................................................................................................................................................
Operators
An operator is a character or reserved word that is used to perform some operation in
Query Builder, such as the + operator, which performs addition. Query Builder uses
several types of operators.
Arithmetic Operators
Arithmetic (+, -, x, /) operators are used to perform calculations on numeric and date
columns. In handling calculations, Query Builder first evaluates any multiplication or
division, and then evaluates any addition or subtraction.
Logical Operators
Logical operators are used to combine conditions. 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, such as NOT NULL
Comparison Operators
Comparison operators are used to compare one expression with another, such that the
result will either be true or false. The browser returns all data for which the result
evaluates true.
Operator
=
<>
<
<=
>
>=
BETWEEN...
AND...
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. A row without a value in one column is said to contain a
NULL value.
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
G-31
Multiple Conditions
......................................................................................................................................................
G-32
Oracle Forms Developer: Build Internet Applications I
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
G-33
Deactivating a Condition
......................................................................................................................................................
G-34
Oracle Forms Developer: Build Internet Applications I
Changing Conditions
.....................................................................................................................................................
Changing Conditions
If you change your mind about including one or more conditions in your query, you
can delete, deactivate, or edit any of them in the Conditions panel.
How to Delete a Condition
1 Click inside the Condition field to activate it.
2 Select Clear from the toolbar or select Delete.
The condition is removed from the query.
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.
Double-clicking the box to the left of the condition or its operator acts as a toggle
switch, alternately turning the condition on and off. Deactivated conditions remain in
the Condition field but appear dimmed.
Additionally, 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.
Note: Hold down the [Shift] key to select multiple conditions.
2 Double-click in the box to deactivate the condition.
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
G-35
......................................................................................................................................................
G-36
Oracle Forms Developer: Build Internet Applications I
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
G-37
......................................................................................................................................................
G-38
Oracle Forms Developer: Build Internet Applications I
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I
G-39
......................................................................................................................................................
G-40
Oracle Forms Developer: Build Internet Applications I