Академический Документы
Профессиональный Документы
Культура Документы
nly
e O
Us
AI
& O
al
40033GC11
ern
Int
Production 1.1
le
May 2001
ac
D32774
Or
Author Copyright Oracle Corporation, 2000, 2001. All rights reserved.
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
Contents
.....................................................................................................................................................
Contents
Preface
Profile xvii
Related Publications xviii
Typographic Conventions xix
Introduction
Overview I-3
Course Objectives I-5
Course Content I-7
y
Getting Started in the Oracle Forms Developer Interface 1-21
Navigating Around the Form Builder Main Menu 1-23
nl
Customizing Your Oracle Forms Developer Session 1-25
e O
s
Saving Tools Preferences 1-27
Oracle Developer Environment Variables 1-29
I U
Environment Variables and Y2K Compliance 1-31
Invoking Online Help Facilities 1-33
OA
l
Introducing the Course Application 1-35
&
na
Summary 1-39
r
nte
Practice 1 Overview 1-41
I
Practice 1 1-42
le
rac
O
.....................................................................................................................................................
Oracle iDS Forms: Build Internet Applications I iii
Contents
.....................................................................................................................................................
y
Form Builder Executables 3-7
Form Builder Module Types 3-9
nl
Form Builder Components 3-11
e O
Summary 3-23
Us
Lesson 4: Creating a Basic Form Module
AI
Introduction 4-3
Creating a New Form Module 4-5
& O
al
Creating a New Data Block 4-11
rn
Modifying the Layout 4-23
e
nt
Template Forms 4-25
e I
Saving, Compiling, and Running a Form Module 4-27
l
ac
Practice 4-1 Overview 4-35
Or
.....................................................................................................................................................
iv Oracle iDS Forms: Build Internet Applications I
Contents
.....................................................................................................................................................
nly
O
Introduction 6-3
What Is a Text Item? 6-5
se
U
Creating a Text Item 6-7
Modifying the Appearance of a Text Item 6-9
AI
Associating Text with an Item Prompt 6-15
Controlling the Data of a Text Item 6-17
& O
al
Altering the Navigational Behavior of a Text Item 6-23
rn
Enhancing the Relationship Between Text Item
e
nt
and Database 6-25
I
Adding Functionality to a Text Item 6-27
e
l
ac
Including Helpful Messages 6-33
Or
.....................................................................................................................................................
Oracle iDS Forms: Build Internet Applications I v
Contents
.....................................................................................................................................................
Summary 6-35
Practice 6 Overview 6-37
Practice 6 6-38
nly
Lesson 9: Creating Noninput Items
e O
Introduction 9-3
Us
I
What Are Noninput Items? 9-5
Creating a Display Item 9-7
Creating an Image Item 9-11
OA
l
Creating a Sound Item 9-19 &
rna
Creating a Push Button 9-25
nte
Creating a Calculated Item 9-31
I
Creating a Hierarchical Tree Item 9-39
e
l
Summary 9-41
ac
Practice 9 Overview 9-43
r
O
Practice 9 9-44
.....................................................................................................................................................
vi Oracle iDS Forms: Build Internet Applications I
Contents
.....................................................................................................................................................
nly
O
Summary 12-15
nte
Adding Functionality Using Built-in Subprograms 13-19
I
Using Triggers 13-27
e
l
Practice 13 Overview 13-32
racPractice 13 13-33
O
.....................................................................................................................................................
Oracle iDS Forms: Build Internet Applications I vii
Contents
.....................................................................................................................................................
nly
O
Triggers for Intercepting System Messages 16-17
Creating and Controlling Alerts 16-21
se
U
Summary 16-31
Practice 16 Overview 16-33
AI
Practice 16 16-34
& O
l
Lesson 17: Query Triggers
a
rn
Introduction 17-3
e
nt
Query Triggers 17-5
e I
SELECT Statements Issued During Query Processing 17-7
l
WHERE and ORDER BY Clauses 17-9
rac
O
.....................................................................................................................................................
viii Oracle iDS Forms: Build Internet Applications I
Contents
.....................................................................................................................................................
nly
O
About Navigation 19-5
Controlling Navigation 19-7
se
U
Understanding Internal Navigation 19-11
Navigation Triggers 19-13
AI
Using the When-New-“object”-Instance Triggers 19-15
Using the Pre- and Post-Triggers 19-17
& O
al
The Navigation Trap 19-19
rn
Navigation in Triggers 19-21
e
nt
Summary 19-23
e I
Practice 19 Overview 19-25
l
ac
Practice 19 19-26
Or
.....................................................................................................................................................
Oracle iDS Forms: Build Internet Applications I ix
Contents
.....................................................................................................................................................
y
Referencing Items Indirectly 21-23
Summary 21-27
nl
Practice 21 Overview 21-29
e O
Practice 21 21-30
Us
Lesson 22: Sharing Objects and Code
AI
Introduction 22-3
Reusable Objects and Code Overview 22-5
& O
al
Property Class 22-7
rn
Creating a Property Class 22-9
e
nt
Inheriting a Property Class 22-11
e I
Creating an Object Group 22-13
l
ac
Copying and Subclassing Objects and Code 22-17
Or
.....................................................................................................................................................
x Oracle iDS Forms: Build Internet Applications I
Contents
.....................................................................................................................................................
nly
O
Practice 4-2 Solutions A-10
Practice 5 Solutions A-13
se
U
Practice 6 Solutions A-16
Practice 7 Solutions A-22
AI
Practice 8 Solutions A-25
Practice 9 Solutions A-27
& O
al
Practice 10 Solutions A-32
rn
Practice 11 Solutions A-33
e
nt
Practice 13 Solutions A-41
e I
Practice 14 Solutions A-43
l
ac
Practice 15 Solutions A-44
Or
.....................................................................................................................................................
Oracle iDS Forms: Build Internet Applications I xi
Contents
.....................................................................................................................................................
y
S_PRODUCT Description B-25
S_PRODUCT Data B-26
nl
S_REGION Description and Data B-30
e O
S_TITLE Description and Data B-31
Us
I
Oracle8 Objects: Types, Tables B-32
nte
e I
l
rac
O
.....................................................................................................................................................
xii Oracle iDS Forms: Build Internet Applications I
Contents
.....................................................................................................................................................
nly
O
Summary F-27
nte
Viewing and Saving Queries G-17
I
Including Additional Tables G-19
e
l
Relationships G-23
rac
O
.....................................................................................................................................................
Oracle iDS Forms: Build Internet Applications I xiii
Contents
.....................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
.....................................................................................................................................................
xiv Oracle iDS Forms: Build Internet Applications I
................................
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
Appendix A: Practice Solutions
......................................................................................................................................................
Practice 1 Solutions
1 Invoke Form Builder, and select “Open an existing form” from the
Welcome page.
No formal solution.
2 Open the Orders.fmb form module from the Open Dialog window.
No formal solution.
3 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.
4 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.
5 Close the ORDERS form.
No formal solution.
6 Open the Summit.fmb form module.
ly
No formal solution.
7 Expand the Data Blocks node.
No formal solution.
On
8 Expand the Database Objects node. If you cannot expand the node,
se
connect to the database and try again. What do you see below this node?
I U
9
No formal solution.
Collapse the Data Blocks node.
OA
l
No formal solution.
&
rna
nte
e I
l
rac
O
......................................................................................................................................................
A-2 Oracle iDS Forms: Build Internet Applications I
Practice 1 Solutions
......................................................................................................................................................
Us
I
Shift-click each of the three shapes to select them together. Move
them to the top-right corner of the layout.
c Select the summit shape in the middle and place it behind the other
OA
l
two shapes.
&
r
Back.
na
Select the middle summit shape, and select Arrange—>Send to
nte
d Draw a box with no fill around the summit shapes.
e I
Select the Rectangle tool from the Tool Palette and draw a
l
rectangle around the three summit shapes. With the rectangle
ac
still selected, click the Fill Color tool and select No Fill.
Or
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications I A-3
Appendix A: Practice Solutions
......................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
A-4 Oracle iDS Forms: 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.
y
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
nl
Oracle. Notice the different appearance of the user interface.
No formal solution.
e O
7 Execute a restricted query to retrieve the “Womansport” record.
Us
Put the form module in Enter Query mode (press [F11] or select
Query—>Enter from menu).
AI
Notice that the status line displays the words ENTER-QUERY.
& O
l
Move to the Name item and enter the search value Womansport.
r
from menu).
na
Execute the query (press [Ctrl] + [F11] or select Query—>Execute
nte
Notice that only one record is retrieved.
e I
l
rac
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications I A-5
Appendix A: Practice Solutions
......................................................................................................................................................
y
No formal solution.
12 Query only those orders with a payment type of Credit.
nl
Select Query—>Enter.
Select the Credit radio button.
e O
Select Query—>Execute.
Us
13 Move to the first record in the Item block and click the Stock button.
AI
O
The Inventory block is displayed in a separate window. Execute a query
to get stock information.
l
No formal solution.
&
14
na
Exit the run-time session.
r
nte
Running a Forms Session in Client-Server
I
1 Start a Forms run-time session by using the form module Customers.
e
l
ac
No formal solution.
Or
......................................................................................................................................................
A-6 Oracle iDS Forms: Build Internet Applications I
Practice 2 Solutions
......................................................................................................................................................
2 Select Help—>Keys from the menu. Notice that the function keys are
defined differently in a client-server environment than they are for Web
deployment.
No formal solution.
3 For the customer Big John’s Sports Emporium, insert a new record in the
ORDER block, as detailed below.
Move to the ORDER block and select Record—>Insert, or press the
Insert button on the toolbar.
Notice that some items are already populated with default values. Enter
the following:
Item Value
Date Shipped Today’s date (DD-MON-YYYY)
Payment Type Cash (radio group button)
Order Filled No (unchecked)
y
Change the Date Shipped to next Monday and save the change.
7 Attempt to delete the order that you have just placed. What happens?
nl
Move to the ORDER block and select Record—>Remove.
e O
s
8 Delete the line item for your order and save the change.
Move to the Item block and select Record—>Remove. Click the
I U
A
Save button.
O
9 Now attempt to delete your order and save the change.
&
Move to the ORDER block and select Record—>Remove. Click the
al
Save button.
10
rn
Exit the run-time session.
e
nt
No formal solution.
e I
l
rac
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications I A-7
Appendix A: Practice Solutions
......................................................................................................................................................
r
e
3 Change the form module name in the Object Navigator to
nt
CUSTOMERS.
I
Select the form module. Click the name. The cursor changes to an
e
l
ac
I-beam. Edit the name, and then press [Return].
Or
......................................................................................................................................................
A-8 Oracle iDS Forms: Build Internet Applications I
Practice 4-1 Solutions
......................................................................................................................................................
4 In the Layout Editor, reposition the items so that the canvas resembles
the following screenshot.
Hint: First resize the canvas and the frame.
Reposition the items by dragging and dropping them.
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications I A-9
Appendix A: Practice Solutions
......................................................................................................................................................
O
Block Wizard.
&
Select block type as Table or View.
l
Set the Base Table to S_ITEM.
a
n
Include all columns.
er
Click the Create Relationship button.
nt
Select S_ORD block as the master block.
I
Use the Layout Wizard to create a layout.
e
l
Select Canvas as CV_ORDER.
rac
O
......................................................................................................................................................
A-10 Oracle iDS Forms: Build Internet Applications I
Practice 4-2 Solutions
......................................................................................................................................................
e O
s
column.
U
Use the Layout Wizard to create a layout.
Select a New Canvas.
Include all items.
AI
Do not change any prompts.
& O
l
Set the Style to Tabular.
rna
Set the Frame Title to Stock.
Set the Displayed Records to 4.
nte
Select the Display Scrollbar check box.
I
In the Object Navigator, rename the canvas to CV_INVENTORY.
e
l
In the Object Navigator, move the S_INVENTORY block after the
ac
S_ITEM block.
Or
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications I A-11
Appendix A: Practice Solutions
......................................................................................................................................................
e O
s
Stock to In Stock, and click Finish.
8 Save and compile your form module.
I U
A
Run your form module on the Web.
O
Execute a query.
&
Navigate through the blocks so that you see the S_INVENTORY block.
l
Exit the run-time session, close Netscape Communicator, and return to
a
n
Form Builder.
er
No formal solution.
nt
9 Change the form module name in the Object Navigator to ORDERS and
save.
e I
l
ac
No formal solution.
Or
......................................................................................................................................................
A-12 Oracle iDS Forms: Build Internet Applications I
Practice 5 Solutions
......................................................................................................................................................
Practice 5 Solutions
CUSTGXX Form
1 Create a control block in the CUSTGXX form.
Create a new block manually, and rename this block CONTROL.
Set the Database Data Block, Query Allowed, Insert Allowed, Update
Allowed, and Delete Allowed Database properties to No. Set the Query
Data Source Type property to None. Leave other properties as default.
Move the CONTROL block after the S_CUSTOMER block.
Select Data Blocks node in the Object Navigator.
Click the Create icon in the Object Navigator, or select
Navigator—>Create option from menu to create a new data block.
Select the “Build a new data block manually” option.
Rename this new data block as CONTROL.
Click the right mouse button on this block, and open the Property
Palette. Find the Database category in the Property Palette.
Set the Database Data Block, Query Allowed, Insert Allowed,
Update Allowed, and Delete Allowed properties to No.
Set the Query Data Source Type property to None.
Leave other properties as default.
In the Object Navigator, move the CONTROL block after the
S_CUSTOMER block.
2 Ensure that the records retrieved in the S_CUSTOMER block are sorted
by the customer’s ID.
In the Property Palette for the S_CUSTOMER block, set the
ORDER BY Clause property to ID.
3 Set the frame properties for the S_CUSTOMER block as follows:
nly
Remove the frame title, and set the Update Layout property to Manually.
e O
s
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
I U
Manually.
OA
&
4 Save and run the CUSTGXX form.
l
Test the effects of the properties that you have set.
a
n
No formal solution.
er
nt
Note: The Compilation Errors window displays a warning that advises you that the
I
CONTROL block has no items. This is expected (until you add some items to the
e
CONTROL block in a later lesson).
l
rac
O
......................................................................................................................................................
Oracle iDS Forms: 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
nly
background color to dark cyan. (If these colors are not available on your
e O
s
window manager, use other colors instead.) Using the Pattern Picker,
U
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.)
AI
Use the multiple selection feature on both data blocks to set the relevant
& O
l
block property to use this visual attribute.
rna
In the Object Navigator, select the Visual Attributes node, and
create a new visual attribute.
nte
In the Property Palette, set the Name property to
I
CURRENT_RECORD.
e
l
Select the Foreground Color property and press the button. The
rac
O
......................................................................................................................................................
A-14 Oracle iDS Forms: Build Internet Applications I
Practice 5 Solutions
......................................................................................................................................................
Us
I
Remove the frame title and set the Update Layout property to Manually.
A
In the Object Navigator, select frames under the Canvases node and
open the Property Palette. Remove the Title property value and set
the Update Layout property to Manually.
& O
11
al
Save and compile the ORDGXX form.
rn
Deploy your form on the Web.
e
nt
Test the effects of the properties that you have set.
I
No formal solution.
le
rac
O
......................................................................................................................................................
Oracle iDS Forms: 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 Suggested Width
ID 60
NAME 195
ADDRESS 195
CITY 195
STATE 130
COUNTRY 195
ZIP_CODE 85
PHONE 160
nly
O
CREDIT_RATING 65
e
SALES_REP_ID 65
COMMENTS 236
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
A-16 Oracle iDS Forms: Build Internet Applications I
Practice 6 Solutions
......................................................................................................................................................
nly
e O
Us
AI
O
5 Save and compile your form.
&
Deploy the form on the Web to test the changes.
al
Note: The entire form may not be visible at this time. This will be
n
addressed in a later lesson.
er
No formal solution.
Int
le
rac
O
......................................................................................................................................................
Oracle iDS Forms: 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.
nly
For Date_Ordered, set Initial Value to $$date$$.
e O
9 In the S_ITEM block, create a new text item called Item_Total.
Us
I
Ensure that Item_Total is not associated with the S_ITEM table.
A
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
& O
999G990D99.
al
n
Set the Prompt text to Item Total. Display this item on the CV_ORDER
canvas.
er
nt
Create a text item and name it Item_Total.
e I
Item Type should be set to Text Item.
l
ac
Set the Database Item, Insert Allowed, Update Allowed, Query
Or
......................................................................................................................................................
A-18 Oracle iDS Forms: Build Internet Applications I
Practice 6 Solutions
......................................................................................................................................................
nly
O
ORDER_FILLED 18
al
QUANTITY_SHIPPED 26
ITEM_TOTAL
ern 86
Int
le
rac
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications I A-19
Appendix A: Practice Solutions
......................................................................................................................................................
y
In the property palette for Product_ID, set Number of Items
Displayed to 1.
nl
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
A-20 Oracle iDS Forms: Build Internet Applications I
Practice 6 Solutions
......................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
Oracle iDS Forms: 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
descriptions to be used with the Product_Id item in the S_ITEM block.
Use the S_PRODUCT table, Id, and Name columns.
Assign a title of Products to the LOV. Assign a column width of 25 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_ITEM.PRODUCT_ID. Attach the LOV
to the Product_Id item in the S_ITEM block. Change the name of the
LOV to PRODUCTS.
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, name
FROM s_product
ORDER BY 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_ITEM.PRODUCT_ID and click the OK button.
Set the display width for ID to 25 and click the Next button.
Enter the title Products. 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.
nly
Click the > button and then the Finish button to create the LOV and attach it
e O
to the Product_Id item.
Us
I
In the Object Navigator, change the name of the new LOV to
PRODUCTS_LOV.
2 Save and compile your form.
OA
l
Deploy the form on the Web to test the changes.
&
rna
No formal solution.
nte
e I
l
rac
O
......................................................................................................................................................
A-22 Oracle iDS Forms: Build Internet Applications I
Practice 7 Solutions
......................................................................................................................................................
U
Click the > button and then the Finish button to create the LOV and attach it
I
A
to the Sales_Rep_Id item.
O
In the Object Navigator, change the name of the new LOV to
&
SALES_REP_LOV.
al
ern
Int
le
rac
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications I A-23
Appendix A: Practice Solutions
......................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
A-24 Oracle iDS Forms: Build Internet Applications I
Practice 8 Solutions
......................................................................................................................................................
Practice 8 Solutions
1 In the CUSTGXX form, convert the Credit_Rating text item into a
pop-up list item.
Add list elements of Poor, Good, and Excellent to represent database
values of POOR, GOOD, and EXCELLENT.
Display any other values as POOR.
Ensure that new records display the initial value GOOD.
Resize the poplist in the Layout Editor, so that the elements do not
truncate at run time.
For Credit_Rating, set Item Type to List Item.
Set the Initial Value to GOOD.
Set the List Style to Poplist.
Set the Mapping of Other Values to POOR.
Select the Elements in List property and click the More button to
invoke the List Elements dialog box.
Enter the elements Poor, Good, and Excellent.
Enter the corresponding database values in the List Item Value box.
Click OK to accept and close the dialog.
Open the Layout Editor and resize the item so that elements do not
truncate.
2 Save and compile the form.
Deploy your form on the Web to test the changes.
No formal solution.
3 In the ORDGXX form, convert the Order_Filled text item to a check box.
Set the checked state to represent the base table value of Y and the
unchecked state to represent N.
nly
O
Ensure that new records are automatically assigned the value N.
e
Allow only records with Order_Filled values of Y or N to be displayed.
Remove the existing prompt and set label as Order Filled.
Us
I
In the Layout Editor, resize the check box so that its label is displayed to
A
the right.
For Order_Filled, set Item Type to Check Box.
Set the Value when Checked to Y and Value when Unchecked to N.
& O
al
Set the Check Box Mapping of Other Values to Not Allowed.
ern
Set the Initial Value to N.
nt
Delete the Prompt property; set the Label property to Order Filled.
I
Open the Layout Editor and resize the check box so that its label is
e
displayed to the right.
l
rac
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications I A-25
Appendix A: Practice Solutions
......................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
A-26 Oracle iDS Forms: 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
Description. Set the Prompt property to Description and display the
prompt above the item.
Open the Layout Editor, ensure that the block is set to S_ITEM, and
select the Display Item tool.
Place the Display Item to the right of the Product_Id.
Set the Name property to Description.
Set the Maximum Length to 50.
Set the Width to 133.
Set the Database Item to No.
Set the Prompt property to Description and the Prompt Attachment
Edge property to Top.
2 Create a single-record image item called Product_Image in the S_ITEM
block of the ORDGXX form.
Display the Layout Editor.
Ensure that the block is set to S_ITEM.
Select the Image Item tool.
Click and drag a box and place it so that it matches the screenshot
below.
Display the Property Palette for the image.
Change the name to Product_Image.
Include these properties for the image item:
Bevel: Lowered, Keyboard Navigable: No, Sizing Style: Adjust,
Database Item: No, Number of Items Displayed: 1.
3 Create another display item, Image_Description, in the S_ITEM block.
nly
O
This should synchronize with the Description item. Set the Maximum
e
Length property to the same value as the Description item.
Display the Layout Editor.
Us
I
Ensure that the block is set to S_ITEM.
A
Select the Display Item tool.
Place the Display Item to just below the Product_Image.
Set the Synchronize with Item to Description.
& O
al
Set the Maximum Length property to 50.
ern
Set the Database Item to No.
nt
Set the Number of Items Displayed to 1.
I
Set the Width to 133.
e
Change the name to Image_Description.
l
rac
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications I A-27
Appendix A: Practice Solutions
......................................................................................................................................................
e O
s
the S_ITEM block.
Set the Position, Size, and Prompt properties according to the
I U
A
screenshot.
O
Set the Format Mask property to 9G999G990D99.
&
Set the Justification property to Right.
l
Set the Number of Items Displayed property to 1.
a
n
Make S_ITEM.total a summary item and display summaries of the
er
item_total values in the S_ITEM block. Ensure that you have set the
nt
Query All Records property to Yes for the S_ITEM block.
e I
l
rac
O
......................................................................................................................................................
A-28 Oracle iDS Forms: Build Internet Applications I
Practice 9 Solutions
......................................................................................................................................................
nly
7 Save, compile, and run the form to test the changes. Change the window
e O
s
size if necessary.
U
No formal solution.
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
Oracle iDS Forms: 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.
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
A-30 Oracle iDS Forms: Build Internet Applications I
Practice 9 Solutions
......................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
Oracle iDS Forms: 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
window to WIN_CUSTOMER, and change its title to Customer
Information. Check that the size and position are suitable.
In the Layout Editor, look at the lowest and rightmost positions of
objects on the canvas, and plan the height and width for the window.
Change the height, width, and title of the window in the Property
Palette.
Change the Title property to Customer Information.
The suggested size is Width 360, Height 360.
The suggested X, Y positions are 10, 10.
2 Save, compile, and run the form to test the changes.
No formal solution.
3 Modify the window in the ORDGXX form. Ensure that the window is
called WIN_ORDER. Also change its title to Orders and Items.
Set the Name property of the existing window to WIN_ORDER.
Set the Title property to Orders and Items.
4 In the ORDGXX form, create a new window called WIN_INVENTORY
suitable for displaying the CV_INVENTORY canvas. Use the rulers in
the Layout Editor to help you plan the height and width of the window.
Set the window title to Stock Levels and Hide on Exit property to Yes.
Place the new window in a suitable position relative to WIN_ORDER.
Create a new window called WIN_INVENTORY.
Set the size, position, and title in the Property Palette.
y
The suggested size is Width 460, Height 340.
The suggested position is X 60, Y 30.
nl
O
Set Hide on Exit to Yes.
5 Associate the CV_INVENTORY canvas with the window
se
U
WIN_INVENTORY. Compile the form. Deploy the form on the Web
and ensure that the S_INVENTORY block is displayed in
WIN_INVENTORY when you navigate to this block.
AI
Set the canvas Window property to WIN_INVENTORY.
& O
l
Compile and run the form on the Web.
6
n
Save the form.
r a
e
No formal solution.
Int
le
rac
O
......................................................................................................................................................
A-32 Oracle iDS Forms: 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 Details
Stock_Button Label: Stock
Mouse Navigate: No
Keyboard Navigable: No
Canvas: Toolbar
Show_Help_Button Label: Show Help
Mouse Navigate: No
Keyboard Navigable: No
Exit_Button
n
Label: Exitly
Canvas: Toolbar
O
Mouse Navigate: No
e
s
Keyboard Navigable: No
U
Canvas: Toolbar
AI
O
Suggested positions for the push buttons are shown in the following illustration:
&
al
ern
Int
le
rac
O
......................................................................................................................................................
Oracle iDS Forms: 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
nly
the Canvases node.
e O
4 Save and compile the form. Deploy the form on the Web to test the
Us
I
changes. Note that the stacked canvas is displayed all the time, providing
A
that it does not obscure the current item in the form.
No formal solution.
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
A-34 Oracle iDS Forms: Build Internet Applications I
Practice 11 Solutions
......................................................................................................................................................
5 Switch off the Visible property of CV_HELP, and then create a push
button in the CONTROL block to hide the Help information when it is
no longer needed. You will add the code later. Display this push button
on the CV_HELP canvas.
Set the Visible Property to No for the CV_HELP.
Create a push button in the CONTROL block with the following
properties:
Push Button Name Details
Hide_Help_Button Label: Hide Help,
Canvas: CV_HELP
Mouse Navigate: No
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
Oracle iDS Forms: 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.
y
Set the Canvas property to TAB_CUSTOMER.
Set the Tab Page property to the tab page that is labeled Address.
nl
O
In the Layout Editor, arrange the items according to the following screenshot.
se
I U
OA
l &
rna
nte
e I
l
rac
O
......................................................................................................................................................
A-36 Oracle iDS Forms: Build Internet Applications I
Practice 11 Solutions
......................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications I A-37
Appendix A: Practice Solutions
......................................................................................................................................................
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
Oracle iDS Forms: 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.
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
A-40 Oracle iDS Forms: Build Internet Applications I
Practice 13 Solutions
......................................................................................................................................................
Practice 13 Solutions
1 In the CUSTGXX form, write a trigger to display the Sales_Rep_Lov
when the Sales_Rep_Lov_Button is selected. To create the
When-Button-Pressed trigger, use the Smart triggers feature. Find the
relevant built-in in the Object Navigator under built-in packages, and use
the “Paste Name and Arguments” feature.
Select the Sales_Rep_Lov_Button in the Object Navigator, press the
right mouse button, select Smart triggers in the pop-up menu, and
select the When-Button-Pressed trigger from the list.
When-Button-Pressed on CONTROL.Sales_Rep_Lov_Button:
IF SHOW_LOV(’sales_rep_lov’) THEN
NULL;
END IF;
2 Create a When-Window-Closed trigger at the form level in order to exit
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;
ly
END IF;
5 Write a trigger that exits the form when the Exit_Button is selected.
When-Button-Pressed on CONTROL.Exit_Button:
On
EXIT_FORM;
se
6 Save, compile, and run the form.
I U
A
No formal solution.
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications I A-41
Appendix A: Practice Solutions
......................................................................................................................................................
y
GO_BLOCK(’S_INVENTORY’);
nl
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
A-42 Oracle iDS Forms: Build Internet Applications I
Practice 14 Solutions
......................................................................................................................................................
Practice 14 Solutions
1 Open your CUSTGXX.FMB file. In this form, create a procedure that is
called List_Of_Values. Import code from the pr14_1.txt file:
PROCEDURE list_of_values(p_lov in VARCHAR2,p_text in VARCHAR2)
IS
v_lov BOOLEAN;
BEGIN
v_lov:= SHOW_LOV(p_lov);
IF v_lov = TRUE THEN
MESSAGE(’You have just selected a ’||p_text);
ELSE
MESSAGE(’You have just cancelled the List of Values’);
END IF;
END;
2 Modify the When-Button-Pressed trigger of
CONTROL.Sales_Lov_Button in order to call this procedure.
When-Button-Pressed on CONTROL.Sales_Lov_Button:
LIST_OF_VALUES(’SALES_REP_LOV’, ’Sales Representative’);
3 Compile and run your form in Debug mode. Set a breakpoint in one of
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.
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
Oracle iDS Forms: 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
changes, allowing only those customers with a good or excellent credit
rating to pay for orders on credit. You can import the pr15_1.txt file.
Open the PL/SQL Editor and select File—>Import Text.
When-Radio-Changed on S_ORD.Payment_Type:
DECLARE
v_credit s_customer.credit_rating%type;
BEGIN
IF :S_ORD.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’;
MESSAGE(’This customer must pay cash’);
END IF;
END IF;
END;
2 In the CONTROL block, create a new button called Image_Button and
position it on the toolbar. Set the Label property to Image Off.
Display the Layout Editor.
Select the Button tool.
Create a button and place it on the toolbar.
Set the Name to Image_Button.
Set the Canvas property to Toolbar.
nly
O
Set the Keyboard Navigable property to No.
e
Set the Mouse Navigate property to No.
Set the Label property to Image Off.
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
A-44 Oracle iDS Forms: Build Internet Applications I
Practice 15 Solutions
......................................................................................................................................................
3 Import the pr15_3.txt file into a trigger that fires when the
Image_Button is clicked. The file contains code that determines the
current value of the visible property of the Product Image item. If the
current value is True, the visible property toggles to False for both the
Product Image item and the Image Description item. Finally, the label
changes on the Image_Button to reflect its next toggle state. However, if
the visible property is currently False, the visible property toggles to
True for both the Product Image item and the Image Description item.
Open the PL/SQL Editor and select File—>Import Text.
When-Button-Pressed on Control.Image_Button:
IF GET_ITEM_PROPERTY(’S_ITEM.product_image’, VISIBLE)=’TRUE’
THEN
SET_ITEM_PROPERTY(’S_ITEM.product_image’, VISIBLE,
PROPERTY_FALSE);
SET_ITEM_PROPERTY(’S_ITEM.image_description’, VISIBLE,
PROPERTY_FALSE);
SET_ITEM_PROPERTY(’CONTROL.image_button’, LABEL,’Image On’);
ELSE
SET_ITEM_PROPERTY(’S_ITEM.product_image’, VISIBLE,
PROPERTY_TRUE);
SET_ITEM_PROPERTY(’S_ITEM.image_description’, VISIBLE,
PROPERTY_TRUE);
SET_ITEM_PROPERTY(’CONTROL.image_button’, LABEL,
’Image Off’);
END IF;
4 Save and compile the form. Deploy the form on the Web.
No formal solution.
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
Oracle iDS Forms: 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’;
y
n := SHOW_ALERT(’payment_type_alert’);
END IF;
nl
O
END IF;
e
END;
3 Create a generic alert called Question_Alert that allows Yes and No
Us
I
replies.
Create an alert.
Set Name to QUESTION_ALERT.
OA
Set Title to Question.
l &
a
Set Alert Style to Stop.
rn
Set Button1 Label to Yes.
e
nt
Set Button2 Label to No.
e I
l
rac
O
......................................................................................................................................................
A-46 Oracle iDS Forms: Build Internet Applications I
Practice 16 Solutions
......................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications I A-47
Appendix A: Practice Solutions
......................................................................................................................................................
Practice 17 Solutions
1 In the ORDGXX form, write a trigger that populates the
Customer_Name and the Sales_Rep_Name for every row fetched by a
query on the S_ORD block.
Post-Query on S_ORD block:
SELECT C.name, E.last_name
INTO :S_ORD.customer_name, :S_ORD.sales_rep_name
FROM S_CUSTOMER C, S_EMP E
WHERE E.id = C.sales_rep_id AND :S_ORD.customer_id = C.id;
2 Write a trigger that populates the Description for every row fetched by a
query on the S_ITEM block.
Post-Query on S_ITEM block:
SELECT name
INTO :S_ITEM.description
FROM S_PRODUCT
WHERE :S_ITEM.product_id = id;
3 Ensure that the Exit_Button has no effect in Enter Query mode.
Ensure that the When-Radio-Changed trigger has no effect in Enter
Query mode.
Set Fire in Enter Query Mode property to No for the
When-Button-Pressed trigger.
Set Fire in Enter Query Mode property to No for the When-Radio-
Changed trigger.
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
A-48 Oracle iDS Forms: Build Internet Applications I
Practice 17 Solutions
......................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
Oracle iDS Forms: 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
Customer_Name, Sales_Rep_Name, and Sales_Rep_Id items whenever
validation occurs on Customer_Id.
Fail the trigger if the customer is not found.
When-Validate-Item on S_ORD.Customer_Id:
SELECT C.name,
C.sales_rep_id,
E.last_name
INTO :S_ORD.customer_name,
:S_ORD.sales_rep_id,
:S_ORD.sales_rep_name
nly
FROM S_CUSTOMER C, S_EMP E
WHERE E.id = C.sales_rep_id AND :S_ORD.customer_id = C.id;
e O
EXCEPTION
Us
I
WHEN NO_DATA_FOUND THEN
A
MESSAGE(’Invalid Customer Id’);
RAISE form_trigger_failure;
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
A-50 Oracle iDS Forms: Build Internet Applications I
Practice 18 Solutions
......................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
Oracle iDS Forms: 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
execute a query at form startup.
When-New-Form-Instance at form level:
EXECUTE_QUERY;
2 Write a trigger that fires as the cursor arrives in each record of the
S_ITEM block, and populate the Product_Image item with a picture of
the product, if one exists.
When-New-Record-Instance on S_ITEM block:
DECLARE
filename VARCHAR2(20);
BEGIN
filename := GET_PRODUCT_IMAGE(:S_ITEM.product_id);
IF filename = ’No file’ THEN
null;
ELSE
READ_IMAGE_FILE(filename,’tiff’,’S_ITEM.product_image’);
END IF;
END;
Get_Product_Image function is already created for you. This function returns
the image filename for the given product number.
FUNCTION get_product_image (product_number IN NUMBER) RETURN
VARCHAR2 IS
v_filename VARCHAR2(20);
BEGIN
SELECT s_image.filename INTO v_filename
FROM s_image, s_product
nly
WHERE s_image.id = s_product.image_id
AND s_product.id = product_number;
e O
IF v_filename is null THEN
Us
I
v_filename := ’No file’;
END IF;
RETURN v_filename;
OA
&
EXCEPTION
al
WHEN no_data_found THEN return(’No file’);
n
END;
er
Int
le
rac
O
......................................................................................................................................................
A-52 Oracle iDS Forms: Build Internet Applications I
Practice 19 Solutions
......................................................................................................................................................
3 Define the same trigger type and code on the S_ORD block.
When-New-Record-Instance on S_ORD block. Use the same code
above.
4 Is there another trigger where you might also want to place this code?
When-Validate-Item on S_ITEM.Product_Id is a candidate for the
code.
You could use a procedure to avoid duplicating the trigger code.
5 Save and compile the form. Deploy the form on the Web to test.
No formal solution.
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
Oracle iDS Forms: 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. Set
the Required property for the ID item to No.
In the Property Palette, set the Enabled and Required properties to
No for S_ORD.Id.
3 Save, compile, and run the form to test.
No formal solution.
4 Create a similar trigger on the S_ITEM block that assigns the Item_Id
when a new record is saved.
Pre-Insert on S_ITEM block:
SELECT NVL(MAX(item_id),0) + 1
INTO :S_ITEM.item_id
FROM S_ITEM
WHERE :S_ITEM.ord_id = ord_id;
Set the Required and Enabled properties to No for S_ITEM.Item_Id.
nly
5 Save and compile the form. Deploy the form on the Web to test.
No formal solution.
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
A-54 Oracle iDS Forms: Build Internet Applications I
Practice 20 Solutions
......................................................................................................................................................
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.
Post-Insert at form level:
DEFAULT_VALUE(’0’, ’GLOBAL.insert’);
:GLOBAL.insert := TO_CHAR( TO_NUMBER( :GLOBAL.insert ) + 1 );
Post-Update at form level:
DEFAULT_VALUE(’0’, ’GLOBAL.update’);
:GLOBAL.update := TO_CHAR( TO_NUMBER( :GLOBAL.update ) + 1 );
Post-Delete at form level:
DEFAULT_VALUE(’0’, ’GLOBAL.delete’);
:GLOBAL.delete := TO_CHAR( TO_NUMBER( :GLOBAL.delete ) + 1 );
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications I A-55
Appendix A: Practice Solutions
......................................................................................................................................................
nly
O
handle_message( message_code, FALSE );
se
I U
OA
l &
rna
nte
e I
l
rac
O
......................................................................................................................................................
A-56 Oracle iDS Forms: Build Internet Applications I
Practice 20 Solutions
......................................................................................................................................................
y
RAISE FORM_TRIGGER_FAILURE;
END IF;
nl
O
END;
se
I U
OA
l &
rna
nte
e I
l
rac
O
......................................................................................................................................................
Oracle iDS Forms: 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
item when the image item is displayed.
Add a test in the code to check Product_Image. Perform the trigger actions only if
the image is currently displayed. Use the GET_ITEM_PROPERTY built-in
function.
When-New-Record-Instance on S_ORD and S_ITEM blocks:
DECLARE
filename VARCHAR2(20);
BEGIN
IF GET_ITEM_PROPERTY(’S_ITEM.product_image’,VISIBLE)=’TRUE’
THEN
filename := GET_PRODUCT_IMAGE(:S_ITEM.product_id);
IF filename = ’No file’ THEN
null;
ELSE
READ_IMAGE_FILE(filename,’tiff’,
’S_ITEM.product_image’);
END IF;
END IF;
END;
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
A-58 Oracle iDS Forms: Build Internet Applications I
Practice 21 Solutions
......................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
Oracle iDS Forms: 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,
consisting of the S_INVENTORY block, CV_INVENTORY canvas,
and WIN_INVENTORY window.
Select the Object Groups node and click the Create icon.
Drag the S_INVENTORY block, CV_INVENTORY canvas, and
WIN_INVENTORY window under the Object Group Children
entry.
2 Save the form.
No formal solution.
3 Create a new form module and copy the Stock_Objects object group into
it.
Select the Forms node and click the Create icon.
Drag Stock_Objects from the ORDERS form to your new module
under the Object Groups node.
Select the Copy options.
4 In the new form module, create a property class called ClassA.
Include the following properties and settings:
Property Setting
Font Name Arial
Format Mask 99,999
Font Size 8
Justification Right
y
Delete Allowed No
Background Color DarkRed
nl
Select the Property Classes node and click the Create icon.
e O
s
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
I U
A
from the list displayed.
O
Set the properties to the values listed above.
&
5 Apply ClassA to CV_INVENTORY, the Restock_Date item, and the
a
Max_In_Stock item.
l
rn
In the Property Palette for each of the items, select the Subclass
e
nt
Information property, and click the More button. In the Subclass
I
Information dialog box, select the Property Class radio button and
e
set the Property Class Name list item to ClassA.
l
rac
O
......................................................................................................................................................
A-60 Oracle iDS Forms: Build Internet Applications I
Practice 22 Solutions
......................................................................................................................................................
6 Save the form module as STOCKXX.fmb, compile, and run the form
and note the error.
You should receive the following error:
Invalid format mask for given datatype for
S_INVENTORY.Restock_Date.
7 Make the Restock_Date format mask a variant property.
Change the Format Mask for S_INVENTORY.Restock_Date to
MM/DD/YYYY.
8 Save, compile, and run the form. Correct the error. Save, compile, and
run the form again.
You should receive the following error:
Cannot resolve reference item reference
s_ITEM.Product_Id
Delete s_ITEM.Product_Id From the Copy Value
From Item property.
9 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.
Select the Object Libraries node in the Object Navigator, and click
the Create button. Rename this object library summit.
Expand the Library Tabs node in the Object Navigator.
Set their label properties as Personal and Corporate.
Drag the CONTROL block, the Toolbar, and the Question_Alert to
the Personal tab of the object library.
Save the summit object library.
nly
10 Create a new form, and create a data block based on the S_DEPT table.
e O
Drag the Toolbar canvas, CONTROL block, and Question_Alert from
Us
I
the object library into the new form. For proper behavior, the S_DEPT
A
block must be before the CONTROL block in the Object Navigator.
Subclass the objects.
& O
Some items are not applicable to this form. Set the Canvas property for
al
the following items to NULL: Image_Button, Stock_Button,
n
Show_Help_Button, Product_Lov_Button, Hide_Help_Button.
er
Use Toolbar as the Horizontal Toolbar canvas for this form.
nt
Set the Window property to WINDOW1 for the Toolbar canvas.
e I
Set the Horizontal Toolbar Canvas property to TOOLBAR for the
l
ac
window.
r
Save this form as DEPTGXX, compile, and run the form to test it.
O
Follow the practice steps; see the DEPTWK22 file for a solution.
......................................................................................................................................................
Oracle iDS Forms: 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.
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
A-62 Oracle iDS Forms: 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
variable called Customer_Id exists.
Pre-Form at form level:
DEFAULT_VALUE(’’,’GLOBAL.customer_id’);
2 Add a trigger to ensure that queries on the S_ORD block are restricted
by the value of GLOBAL.Customer_Id
Pre-Query on S_ORD block:
:S_ORD.customer_id := :GLOBAL.customer_id;
3 Save, compile, and run the form to test that it works as a stand-alone.
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 customer’s 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.
y
7 Change the window location of the ORDGXX form, if required.
No formal solution.
nl
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications I A-63
Appendix A: Practice Solutions
......................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
A-64 Oracle iDS Forms: Build Internet Applications I
................................
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
Appendix B: Table Descriptions and Data
.....................................................................................................................................................
ORD_ID
ID
S_ITEM S_ORD
PRODUCT_ID CUSTOMER_ID
SALES_REP_ID
S_INVENTORY
PRODUCT_ID
ID
ID ID
S_CUSTOMER
S_PRODUCT SALES_REP_ID
IMAGE_ID
ID ID ID
S_IMAGE S_EMP
DEPT_ID
nly
e O ID
S_DEPT
Us
A I
*Unique occurrences are identified by PRODUCT_ID and
WAREHOUSE_ID.
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
B-2 Oracle Forms Developer: Build Internet Applications I
S_CUSTOMER Description
.....................................................................................................................................................
S_CUSTOMER Description
Column Name Null? Datatype
-------------- --------- ------------- -----------------
ID NOT NULL NUMBER(7)
NAME NOT NULL VARCHAR2(50)
PHONE VARCHAR2(25)
ADDRESS VARCHAR2(400)
CITY VARCHAR2(30)
STATE VARCHAR2(20)
COUNTRY VARCHAR2(30)
ZIP_CODE VARCHAR2(75)
CREDIT_RATING VARCHAR2(9)
SALES_REP_ID NUMBER(7)
REGION_ID NUMBER(7)
COMMENTS VARCHAR2(255)
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I B-3
Appendix B: Table Descriptions and Data
.....................................................................................................................................................
S_CUSTOMER Data
nly
203 Delhi Sports 91-10351 11368 Chanakya
e O
New Delhi India
Us
Good 14 4
AI
O
Customer specializes in baseball equipment and is the largest
retailer in India.
l &
rna
nte
e I
l
rac
O
......................................................................................................................................................
B-4 Oracle Forms Developer: Build Internet Applications I
S_CUSTOMER Data
.....................................................................................................................................................
e O Nigeria
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I B-5
Appendix B: Table Descriptions and Data
.....................................................................................................................................................
y
EXCELLENT 12 2
Customer is difficult to reach by phone. Try mail.
nl
e O
s
211 Kuhn’s Sports 42-111292 7 Modrany
Prague
I U Czechoslovakia
A
EXCELLENT 15 5
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
B-6 Oracle Forms Developer: Build Internet Applications I
S_CUSTOMER Data
.....................................................................................................................................................
ly
Buffalo NY USA
14202 POOR 11
On 1
l &
rna
nte
I
Note: This display has been formatted.
le
rac
O
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I B-7
Appendix B: Table Descriptions and Data
.....................................................................................................................................................
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
12 rows selected.
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
B-8 Oracle Forms Developer: Build Internet Applications I
S_EMP Description
.....................................................................................................................................................
S_EMP Description
Column Name Null? Datatype
------------------------ -------------- --------------
ID NOT NULL NUMBER(7)
LAST_NAME NOT NULL VARCHAR2(25)
FIRST_NAME VARCHAR2(25)
USERID VARCHAR2(8)
START_DATE DATE
COMMENT VARCHAR2(255)
MANAGER_ID NUMBER(7)
TITLE VARCHAR2(25)
DEPT_ID NUMBER(7)
SALARY NUMBER(11,2)
COMMISSION_PCT NUMBER(4,2)
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I B-9
Appendix B: Table Descriptions and Data
.....................................................................................................................................................
S_EMP Data
nly
O
5 Ropeburn Audry aropebur 04-MAR-90
e
1 VP, Administration 50 1550
Us
6 Urguhart Molly
2 Warehouse Manager
AI murguhar 18-JAN-91
41 1200
& O
7
al
Menchu Roberta rmenchu 14-MAY-90
n
2 Warehouse Manager 42 1250
er
nt
8 Biri Ben bbiri 07-APR-90
I
2 Warehouse Manager 43 1100
le
ac
9 Catchpole Antoinette acatchpo 09-FEB-92
......................................................................................................................................................
B-10 Oracle Forms Developer: Build Internet Applications I
S_EMP Data
.....................................................................................................................................................
e O
14 Nguyen Mai
Us mnguyen 22-JAN-92
I
3 Sales Representative 34 1525
15
OA
l
15 Dumas Andre
& adumas 09-OCT-91
nte
17.5
e I
l
16 Maduro Elena emaduro 07-FEB-92
ac
6 Stock Clerk 41 1400
Or
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I B-11
Appendix B: Table Descriptions and Data
.....................................................................................................................................................
21 Markarian
8 Stock Clerk
Alexander
e O
22 Chang Eddie
Us echang 30-NOV-90
I
9 Stock Clerk 44 800
23 Patel Radha
OA rpatel 17-OCT-90
l
9 Stock Clerk
& 34 795
rna
e
24 Dancs Bela bdancs 17-MAR-91
Int
10 Stock Clerk 45 860
le
ac
25 Schwartz Sylvie sschwart 09-MAY-91
......................................................................................................................................................
B-12 Oracle Forms Developer: Build Internet Applications I
S_IMAGE Description and Data
.....................................................................................................................................................
ID FORMAT U FILENAME I
----- ----------------------- - ---------------------------- -
1001 JTIFF Y bunboot.tif
1002 JTIFF Y aceboot.tif
1003 JTIFF Y proboot.tif
1011 JTIFF Y bunpole.tif
1012 JTIFF Y acepole.tif
1013 JTIFF Y propole.tif
1291 JTIFF Y gpbike.tif
1296 JTIFF Y himbike.tif
y
1829 JTIFF Y safthelm.tif
1381 JTIFF Y
nl
probar.tif
1382 JTIFF Y
O
curlbar.tif
e
s
1119 JTIFF Y baseball.tif
U
1223 JTIFF Y chaphelm.tif
1367 JTIFF Y
AI
grglove.tif
O
1368 JTIFF Y alglove.tif
1369
l
JTIFF Y
& stglove.tif
a
1480 JTIFF Y cabbat.tif
1482
nt
1486 JTIFF Y winbat.tif
e I
l
ac
19 rows selected.
Or
Note: The above output has been formatted.
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I B-13
Appendix B: Table Descriptions and Data
.....................................................................................................................................................
y
10022 101 300 200 350
10023 101 400 300 525
nl
20106 101 993 625 1000
e O
PRODUCT_ID WAREHOUSE AMT_IN_STOCK REORD_PT MAX_IN_STOCK
Us
---------- --------- ------------ --------- ------------
AI
O
OUT_OF_STOCK RESTOCK_D
------------------------- ---------
l &
a
20108 101 700 700 1225
20201
nt
20510 101 1389 850 1400
e I
20512 101 850 850 1450
l
ac
30321 101 2000 1500 2500
r
30326 101 2100 2000 3500
O
......................................................................................................................................................
B-14 Oracle Forms Developer: Build Internet Applications I
S_INVENTORY Description and Data
.....................................................................................................................................................
nly
O
41100 101 350 350 600
e
50169 101 2530 1500 2600
Us
AI
O
PRODUCT_ID WAREHOUSE AMT_IN_STOCK REORD_PT MAX_IN_STOCK
&
---------- --------- ------------ --------- ------------
al
OUT_OF_STOCK RESTOCK_D
rn
------------------------- ---------
e
nt
50273 101 233 200 350
I
50417 101 518 500 875
ac
50419 101 230 120 310
Or 50530
50532
101
101
669
0
400
100
700
175
Wait for Spring. 12-APR-93
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I B-15
Appendix B: Table Descriptions and Data
.....................................................................................................................................................
y
30433 201 130 130 230
32779 201 180 150 260
nl
O
32861 201 132 80 140
se
I U
A
PRODUCT_ID WAREHOUSE AMT_IN_STOCK REORD_PT MAX_IN_STOCK
O
---------- --------- ------------ --------- ------------
&
OUT_OF_STOCK RESTOCK_D
al
------------------------- ---------
50169
nt
50273 201 75 60 100
e I
50417 201 82 60 100
l
50418 201 98 60 100
rac
50419 201 77 60 100
O
50530 201 62 60 100
......................................................................................................................................................
B-16 Oracle Forms Developer: Build Internet Applications I
S_INVENTORY Description and Data
.....................................................................................................................................................
y
40422 301 65 40 70
41010 301 59 40 70
nl
O
41020 301 61 40 70
se
I U
A
PRODUCT_ID WAREHOUSE AMT_IN_STOCK REORD_PT MAX_IN_STOCK
O
---------- --------- ------------ --------- ------------
&
OUT_OF_STOCK RESTOCK_D
al
------------------------- ---------
41050
ern 301 49 40 70
nt
41080 301 50 40 70
41100
e I 301 42 40 70
l
20510 401 88 50 100
rac
20512 401 75 75 140
O
30321 401 102 80 140
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I B-17
Appendix B: Table Descriptions and Data
.....................................................................................................................................................
y
------------------------- ---------
32861 401 250 150 250
nl
O
40421 401 47 40 70
40422 401 50 40 70
se
U
41010 401 80 70 220
41020 401 91 70 220
AI
O
41050 401 169 70 220
l &
rna
nte
e I
l
rac
O
......................................................................................................................................................
B-18 Oracle Forms Developer: Build Internet Applications I
S_INVENTORY Description and Data
.....................................................................................................................................................
y
10012 10501 300 300 525
10013 10501 314 300 525
nl
O
10022 10501 502 300 525
se
I U
A
PRODUCT_ID WAREHOUSE AMT_IN_STOCK REORD_PT MAX_IN_STOCK
O
---------- --------- ------------ --------- ------------
&
OUT_OF_STOCK RESTOCK_D
al
------------------------- ---------
10023
nt
20106 10501 150 100 175
e I
20108 10501 222 200 350
l
20201 10501 275 200 350
rac
20510 10501 57 50 87
O
20512 10501 62 50 87
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I B-19
Appendix B: Table Descriptions and Data
.....................................................................................................................................................
y
41020 10501 224 140 245
41050 10501 157 140 245
nl
O
41080 10501 159 140 245
se
I U
A
PRODUCT_ID WAREHOUSE AMT_IN_STOCK REORD_PT MAX_IN_STOCK
O
---------- --------- ------------ --------- ------------
&
OUT_OF_STOCK RESTOCK_D
al
------------------------- ---------
ern
41100 10501 141 140 245
Int
le
rac
114 rows selected.
O
Note: The above output has been formatted.
......................................................................................................................................................
B-20 Oracle Forms Developer: Build Internet Applications I
S_ITEM Description
.....................................................................................................................................................
S_ITEM Description
Column Name Null? Datatype
------------------------- -------------- ----------
ORD_ID NOT NULL NUMBER(7)
ITEM_ID NOT NULL NUMBER(7)
PRODUCT_ID NOT NULL NUMBER(7)
PRICE NUMBER(11,2)
QUANTITY NUMBER(9)
QUANTITY_SHIPPED NUMBER(9)
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I B-21
Appendix B: Table Descriptions and Data
.....................................................................................................................................................
S_ITEM Data
U
13
s 13
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
B-22 Oracle Forms Developer: Build Internet Applications I
S_ITEM Data
.....................................................................................................................................................
y
109 4 30326 582 1500 1500
109 2 10012 175 600
nl 600
O
109 3 10022 21.95 300 300
e
110 1 50273 22.89 17 17
110 2 50536 50 23
Us 23
I
111 1 40421 65 27 27
A
111 2 41080 35 29 29
O
97 1 20106 9 1000 1000
&
97 2 303211 500 50 50
l
98 1 404218 5 7 7
99
99
rna 1
2
20510
20512
9
8
18
25
18
25
99
nte 3 50417 80 53 53
I
99 4 50530 45 69 69
le
112 1 20106 11 50 50
rac
62 rows selected.
O
Note: This display has been formatted.
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I B-23
Appendix B: Table Descriptions and Data
.....................................................................................................................................................
nly 2770
84000
CASH
CREDIT
Y
Y
O
98 202 31-AUG-92 10-SEP-9214 595 CASH Y
e
99 203 31-AUG-92 18-SEP-9214 7707 CREDIT Y
s
112 210 31-AUG-92 10-SEP-9212 550 CREDIT Y
16 rows selected.
I U
OA
l &
rna
nte
e I
l
rac
O
......................................................................................................................................................
B-24 Oracle Forms Developer: Build Internet Applications I
S_PRODUCT Description
.....................................................................................................................................................
S_PRODUCT Description
Column Name Null? Datatype
---------------------------------- -----------------
ID NOT NULL NUMBER(7)
NAMENOT NULL VARCHAR2(50)
SHORT_DESC VARCHAR2(255)
LONGTEXT_ID NUMBER(7)
IMAGE_ID NUMBER(7)
SUGGESTED_WHLSL_PRICE NUMBER(11,2)
WHLSL_UNITS VARCHAR2(25)
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I B-25
Appendix B: Table Descriptions and Data
.....................................................................................................................................................
S_PRODUCT Data
y
20106 Junior Soccer BallJunior soccer ball613
11
nl
20108 World Cup Soccer BallWorld cup soccer ball615
e O
28
Us
20201 World Cup NetWorld cup net
AI 708
O
123
l &
rna
nte
e I
l
rac
O
......................................................................................................................................................
B-26 Oracle Forms Developer: Build Internet Applications I
S_PRODUCT Data
.....................................................................................................................................................
nly
e O
s
32861 Safe-T HelmetBicycle helmet 1368
U
1829 60
1381
Lifting Bar
65
& O
al
rn
40422 Pro Curling BarCurling bar 929
e
1382 50
Int
le
rac
O
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I B-27
Appendix B: Table Descriptions and Data
.....................................................................................................................................................
nly
41100 Prostar 100 One hundred pound 607
e O
s
Pound Weightweight
U
45
1119
Baseball
4.29
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
B-28 Oracle Forms Developer: Build Internet Applications I
S_PRODUCT Data
.....................................................................................................................................................
nly
Note: This display has been formatted.
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I B-29
Appendix B: Table Descriptions and Data
.....................................................................................................................................................
ID NAME
--- --------------------------
1 North America
2 South America
3 Africa / Middle East
4 Asia
5 Europe
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
B-30 Oracle Forms Developer: Build Internet Applications I
S_TITLE Description and Data
.....................................................................................................................................................
TITLE
------------------------
President
Sales Representative
Stock Clerk
VP, Administration
VP, Finance
VP, Operations
VP, Sales
Warehouse Manager
8 rows selected.
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I B-31
Appendix B: Table Descriptions and Data
.....................................................................................................................................................
emp_type_RefCol
Name Null? Type
-------------------- ------------- ----------------
ID NUMBER(7)
LAST_NAME VARCHAR2(25)
FIRST_NAME VARCHAR2(25)
USERID VARCHAR2(8)
ly
START_DATE DATE
MANAGER_ID
TITLE
On NUMBER(7)
VARCHAR2(25)
DEPT_ID
se REF OF DEPT_TYPE
SALARY
I U NUMBER(11,2)
COMMISSION_PCT
OA NUMBER(4,2)
&
dept_type
---------------------------------
al ----------------
ID
ern NUMBER
Int
NAME VARCHAR2(25)
REGION_ID NUMBER(7)
le
rac
O
......................................................................................................................................................
B-32 Oracle Forms Developer: Build Internet Applications I
Oracle8 Objects: Types, Tables
.....................................................................................................................................................
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
nly
O
03-MAR-90 President
DEPT_TYPE(50, ’Administration’, 1)
se
U
2500
AI
O
2Ngao LaDorislngao
&
08-MAR-90 1 VP Operations
al
DEPT_TYPE(41, ’Operations’, 1)
1450
ern
Int
3Nagayama Midorimnagayam
le
17-JUN-91 1 VP Sales
ac
DEPT_TYPE(31, ’Sales’, 1)
IDOr 1400
LAST_NAME FIRST_NAME USERID
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I B-33
Appendix B: Table Descriptions and Data
.....................................................................................................................................................
ly
7 Menchu Roberta rmenchu
14-MAY-90 2 Warehouse Manager
DEPT_TYPE(42, ’Operations’, 2)
On
1250
se
I U
8
07-APR-90
Biri Ben
2 Warehouse Manager
bbiri
OA
l
DEPT_TYPE(43, ’Operations’, 3)
&
1100
rna
9
nte Catchpole Antoinette acatchpo
e I
09-FEB-92 2 Warehouse Manager
l
ac
DEPT_TYPE(44, ’Operations’, 4)
r
1300
O
ID LAST_NAME FIRST_NAME USERID
---------- ------------------------------ --------
......................................................................................................................................................
B-34 Oracle Forms Developer: Build Internet Applications I
Oracle8 Objects: Types, Tables
.....................................................................................................................................................
ly
18-FEB-91 3 Sales Representative
DEPT_TYPE(33, ’Sales’, 3)
1515 10
On
se
14 Nguyen Mai mnguyen
I U
22-JAN-92 3 Sales Representative
DEPT_TYPE(34, ’Sales’, 4)
OA
1525 15
l &
rna
e
15 Dumas Andre adumas
nt
09-OCT-91 3 Sales Representative
e I
DEPT_TYPE(35, ’Sales’, 5)
l
ac
145018
r
ID LAST_NAME FIRST_NAME USERID
O
---------- -------------- --------------- --------
START_DAT MANAGER_ID TITLE
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I B-35
Appendix B: Table Descriptions and Data
.....................................................................................................................................................
ly
DEPT_TYPE(42, ’Operations’, 2)
795
On
20 Newman Chad
se cnewman
21-JUL-91 8 Stock Clerk
I U
DEPT_TYPE(43, ’Operations’, 3)
750
OA
l &
21
e
26-MAY-91 8 Stock Clerk
nt
DEPT_TYPE(43, ’Operations’, 3)
e I
850
l
ac
ID LAST_NAME FIRST_NAME USERID
r
---------- ------------------------------ --------
O
START_DAT MANAGER_ID
--------- ----------
TITLE
-------------------------
......................................................................................................................................................
B-36 Oracle Forms Developer: Build Internet Applications I
Oracle8 Objects: Types, Tables
.....................................................................................................................................................
ly
1100
oo_emp_Table_RefCol
On
Name Null?
se Type
U
------------------------------ ----------------
ID
AI NUMBER(7)
O
LAST_NAME VARCHAR2(25)
&
FIRST_NAME VARCHAR2(25)
USERID
al VARCHAR2(8)
START_DATE
ern DATE
nt
MANAGER_ID NUMBER(7)
I
TITLE VARCHAR2(25)
l
DEPT_ID
e REF OF DEPT_TYPE
ac
SALARY NUMBER(11,2)
Or
COMMISSION_PCTNUMBER(4,2)
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I B-37
Appendix B: Table Descriptions and Data
.....................................................................................................................................................
y
0000220208447F54A9ED5A676AE03408002072C15B447F54A9ED55676AE03408
002072C15B
nl
O
1400
se
U
4 Quick-To-See Mark mquickto
07-APR-90 1 VP Finance
AI
O
0000220208447F54A9ED59676AE03408002072C15B447F54A9ED55676AE03408
002072C15B
1450
l &
rna
nte
5 Ropeburn Audry aropebur
I
04-MAR-90 1 VP Administration
le
0000220208447F54A9ED64676AE03408002072C15B447F54A9ED55676AE03408
ac
002072C15B
Or 1550
......................................................................................................................................................
B-38 Oracle Forms Developer: Build Internet Applications I
Oracle8 Objects: Types, Tables
.....................................................................................................................................................
y
0000220208447F54A9ED63676AE03408002072C15B447F54A9ED55676AE03408
002072C15B
nl
O
1307
se
U
11 Magee Colin cmagee
14-MAY-90 3 Sales Representative
AI
O
0000220208447F54A9ED5A676AE03408002072C15B447F54A9ED55676AE03408
002072C15B
1400
l 10
&
rna
nte
13 Sedeghi Yasmin ysedeghi
I
18-FEB-91 3 Sales Representative
le
0000220208447F54A9ED5C676AE03408002072C15B447F54A9ED55676AE03408
ac
002072C15B
Or 1515 10
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I B-39
Appendix B: Table Descriptions and Data
.....................................................................................................................................................
y
0000220208447F54A9ED5F676AE03408002072C15B447F54A9ED55676AE03408
002072C15B
nl
O
1400
se
U
17 Smith George gsmith
08-MAR-90 6 Stock Clerk
AI
O
0000220208447F54A9ED5F676AE03408002072C15B447F54A9ED55676AE03408
002072C15B
940
l &
rna
nte
18 Nozaki Akira anozaki
I
09-FEB-91 7 Stock Clerk
le
0000220208447F54A9ED60676AE03408002072C15B447F54A9ED55676AE03408
ac
002072C15B
Or 1200
......................................................................................................................................................
B-40 Oracle Forms Developer: Build Internet Applications I
Oracle8 Objects: Types, Tables
.....................................................................................................................................................
y
0000220208447F54A9ED61676AE03408002072C15B447F54A9ED55676AE03408
002072C15B
nl
O
850
se
U
22 Chang Eddie echang
30-NOV-90 9 Stock Clerk
AI
O
0000220208447F54A9ED62676AE03408002072C15B447F54A9ED55676AE03408
002072C15B
800
l &
rna
nte
23 Patel Radha rpatel
I
17-OCT-90 9 Stock Clerk
le
0000220208447F54A9ED5D676AE03408002072C15B447F54A9ED55676AE03408
ac
002072C15B
Or 795
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I B-41
Appendix B: Table Descriptions and Data
.....................................................................................................................................................
oo_dept_table
Name Null? Type
-------------------- ------------- ----------------
ID
NAME
nly NUMBER
VARCHAR2(25)
REGION_ID
e O NUMBER(7)
Us
ID NAME
AI REGION_ID
-------------------- -------------
& O ----------------
l
10 Finance 1
31
rna Sales 1
e
32 Sales 2
nt
33 Sales 3
34
e I Sales 4
l
ac
35 Sales 5
r
41 Operations 1
O
42
43
Operations
Operations
2
3
44 Operations 4
45 Operations 5
50 Administration 1
......................................................................................................................................................
B-42 Oracle Forms Developer: Build Internet Applications I
Oracle8 Objects: Types, Tables
.....................................................................................................................................................
rel_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)
y
---------- --------------
1 Velasquez Carmen cvelasqu
nl
03-MAR-90 President
e O
s
DEPT_TYPE(50, ’Administration’, 1)
2500
I U
2 Ngao LaDoris
OA lngao
l
08-MAR-90 1 VP Operations
&
rna
DEPT_TYPE(41, ’Operations’, 1)
e
1450
Int
e
3 Nagayama Midori mnagayam
l
ac
17-JUN-91 1 VP Sales
r
DEPT_TYPE(31, ’Sales’, 1)
O 1400
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I B-43
Appendix B: Table Descriptions and Data
.....................................................................................................................................................
e O
s
DEPT_TYPE(42, ’Operations’, 2)
1250
I U
8 Biri Ben bbiri
OA
07-APR-90
l
2 Warehouse Manager
&
na
DEPT_TYPE(43, ’Operations’, 3)
r
e
1100
Int
e
9 Catchpole Antoinette acatchpo
l
ac
09-FEB-92 2 Warehouse Manager
r
DEPT_TYPE(44, ’Operations’, 4)
O 1300
......................................................................................................................................................
B-44 Oracle Forms Developer: Build Internet Applications I
Oracle8 Objects: Types, Tables
.....................................................................................................................................................
e O
s
DEPT_TYPE(33, ’Sales’, 3)
1515 10
I U
14 Nguyen Mai mnguyen
OA
22-JAN-92
l
3 Sales Representative
&
na
DEPT_TYPE(34, ’Sales’, 4)
r
e
1525 15
Int
e
15 Dumas Andre adumas
l
ac
09-OCT-91 3 Sales Representative
r
DEPT_TYPE(35, ’Sales’, 5)
O 1450 18
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I B-45
Appendix B: Table Descriptions and Data
.....................................................................................................................................................
19 Patel Vikram
nly vpatel
06-AUG-91 7 Stock Clerk
e O
s
DEPT_TYPE(42, ’Operations’, 2)
795
I U
20 Newman Chad
OA cnewman
21-JUL-91
l
8 Stock Clerk
&
na
DEPT_TYPE(43, ’Operations’, 3)
r
e
750
Int
e
21 Markarian Alexander amarkari
l
ac
26-MAY-91 8 Stock Clerk
r
DEPT_TYPE(43, ’Operations’, 3)
O 850
......................................................................................................................................................
B-46 Oracle Forms Developer: Build Internet Applications I
Oracle8 Objects: Types, Tables
.....................................................................................................................................................
25 Schwartz Sylvie
nly sschwart
09-MAY-91 10 Stock Clerk
e O
s
DEPT_TYPE(45, ’Operations’, 5)
1100
I U
OA
l &
rna
nte
e I
l
rac
O
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I B-47
Appendix B: Table Descriptions and Data
.....................................................................................................................................................
rel_emp_Table_RefCol
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 REF OF DEPT_TYPE
SALARY NUMBER(11,2)
COMMISSION_PCT NUMBER(4,2)
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
B-48 Oracle Forms Developer: Build Internet Applications I
Oracle8 Objects: Types, Tables
.....................................................................................................................................................
y
0000220208447F54A9ED5A676AE03408002072C15B447F54A9ED55676AE03408
002072C15B
nl
O
1400
se
U
4 Quick-To-See Mark mquickto
07-APR-90 1 VP Finance
AI
O
0000220208447F54A9ED59676AE03408002072C15B447F54A9ED55676AE03408
002072C15B
1450
l &
rna
nte
5 Ropeburn Audry aropebur
I
04-MAR-90 1 VP Administration
le
0000220208447F54A9ED64676AE03408002072C15B447F54A9ED55676AE03408
ac
002072C15B
Or 1550
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I B-49
Appendix B: Table Descriptions and Data
.....................................................................................................................................................
y
0000220208447F54A9ED63676AE03408002072C15B447F54A9ED55676AE03408
002072C15B
nl
O
1307
se
U
11 Magee Colin cmagee
14-MAY-90 3 Sales Representative
AI
O
0000220208447F54A9ED5A676AE03408002072C15B447F54A9ED55676AE03408
002072C15B
1400
l 10
&
rna
nte
13 Sedeghi Yasmin ysedeghi
I
18-FEB-91 3 Sales Representative
le
0000220208447F54A9ED5C676AE03408002072C15B447F54A9ED55676AE03408
ac
002072C15B
Or 1515 10
......................................................................................................................................................
B-50 Oracle Forms Developer: Build Internet Applications I
Oracle8 Objects: Types, Tables
.....................................................................................................................................................
y
0000220208447F54A9ED5F676AE03408002072C15B447F54A9ED55676AE03408
002072C15B
nl
O
1400
se
U
17 Smith George gsmith
08-MAR-90 6 Stock Clerk
AI
O
0000220208447F54A9ED5F676AE03408002072C15B447F54A9ED55676AE03408
002072C15B
940
l &
rna
nte
18 Nozaki Akira anozaki
I
09-FEB-91 7 Stock Clerk
le
0000220208447F54A9ED60676AE03408002072C15B447F54A9ED55676AE03408
ac
002072C15B
Or 1200
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I B-51
Appendix B: Table Descriptions and Data
.....................................................................................................................................................
y
0000220208447F54A9ED61676AE03408002072C15B447F54A9ED55676AE03408
002072C15B
nl
O
850
se
U
22 Chang Eddie echang
30-NOV-90 9 Stock Clerk
AI
O
0000220208447F54A9ED62676AE03408002072C15B447F54A9ED55676AE03408
002072C15B
800
l &
rna
nte
23 Patel Radha rpatel
I
17-OCT-90 9 Stock Clerk
le
0000220208447F54A9ED5D676AE03408002072C15B447F54A9ED55676AE03408
ac
002072C15B
Or 795
......................................................................................................................................................
B-52 Oracle Forms Developer: Build Internet Applications I
Oracle8 Objects: Types, Tables
.....................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I B-53
Appendix B: Table Descriptions and Data
.....................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
B-54 Oracle Forms Developer: Build Internet Applications I
................................
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
Appendix C: Oracle Rdb Overview
......................................................................................................................................................
Supported Platforms
Oracle Rdb is available on the following computing platforms:
• OpenVMS VAX
• OpenVMS Alpha
• Windows NT Intel
e
optimizer, and query outlines for repeatable query performance.
• Ease of management
Us
Rdb provides comprehensive, simple management of Rdb databases. Default
database settings provide great performance for Rdb out of the box. The Oracle
AI
Rdb server includes management utilities that are accessed using a command-line
& O
l
interface, and the Enterprise Manager DBAPack for Rdb provides a complete set
rna
of management tools for Rdb that can be run from the Oracle Enterprise Manager
console. The TRACE/Expert Option provides performance monitoring and expert
nte
database design for Rdb. Rdb8 integration with Oracle Enterprise Manager
I
provides common graphical interfaces to manage Rdb and Oracle RDBMS from
e
l
the same Windows console.
rac
O
......................................................................................................................................................
C-2 Oracle iDS Forms: Build Internet Applications I
What Is Oracle Rdb?
......................................................................................................................................................
I U
OA
l &
rna
nte
e I
l
rac
O
......................................................................................................................................................
Oracle iDS Forms: 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.
e O
s
address, and company, to:
infordb@us.oracle.com
I U
A
Specify that you would like to receive the free Oracle Rdb CD-ROM.
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
C-4 Oracle iDS Forms: Build Internet Applications I
................................
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
Appendix D: Locking in Form Builder
......................................................................................................................................................
Objectives
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
D-2 Oracle iDS Forms: 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.
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications I D-3
Appendix D: Locking in Form Builder
......................................................................................................................................................
Locking
Row in (X)
Row in (X)
Query
Table in (RX)
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
D-4 Oracle iDS Forms: 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:
ly
Row Share (RS) table lock Prevents the above lock (X) from being applied to
n
the entire table; usually occurs because of
O
SELECT . . . FOR UPDATE
Row Exclusive (RX) table lock
e
Allows write operations on a table from several
s
U
sessions simultaneously, but prevents (X) lock on
I
entire table; usually occurs because of a DML
operation
OA
l &
rna
nte
e I
l
rac
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications I D-5
Appendix D: Locking in Form Builder
......................................................................................................................................................
y
already locked the record.
nl
e O
Us
AI
& O
al Copyright Oracle Corporation, 2000. All rights reserved.
ern
Int
le
rac
O
......................................................................................................................................................
D-6 Oracle iDS Forms: Build Internet Applications I
Default Locking in Forms
......................................................................................................................................................
*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.
&
• A row is already locked by another user. The user has the option of
l
waiting or trying again later.
a
ern
• Another user has committed changes since a record was queried. The
user must requery before the user’s own change can be applied.
Int
le
rac
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications I D-7
Appendix D: Locking in Form Builder
......................................................................................................................................................
User A: Step 1
User B: Step 2
nly
e O
Us
AI
& O
al Copyright Oracle Corporation, 2000. All rights reserved.
ern
Int
le
rac
O
......................................................................................................................................................
D-8 Oracle iDS Forms: Build Internet Applications I
Default Locking in Forms
......................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications I D-9
Appendix D: Locking in Form Builder
......................................................................................................................................................
User A: Step 3
User B: Step 4
nly
e O
Us
AI
& O
al Copyright Oracle Corporation, 2000. All rights reserved.
ern
Int
le
rac
O
......................................................................................................................................................
D-10 Oracle iDS Forms: Build Internet Applications I
Default Locking in Forms
......................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications I D-11
Appendix D: Locking in Form Builder
......................................................................................................................................................
Achieved by:
• SQL data manipulation language
• SQL explicit locking statements
• Built-in subprograms
• DML statements
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
D-12 Oracle iDS Forms: 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 user’s changes, just before the end of a transaction
when locks are released.
e
changes have been applied, it is advantageous to code DML statements as
efficiently as possible, so that their actions are completed quickly.
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications I D-13
Appendix D: Locking in Form Builder
......................................................................................................................................................
• ENTER_QUERY (FOR_UPDATE)
• EXECUTE_QUERY (FOR_UPDATE)
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
D-14 Oracle iDS Forms: Build Internet Applications I
Locking in Triggers
......................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
Oracle iDS Forms: 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;
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
D-16 Oracle iDS Forms: 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 user’s 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 user’s 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’);
y
RAISE form_trigger_failure;
END IF;
nl
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
Oracle iDS Forms: 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
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
D-18 Oracle iDS Forms: 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
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications I D-19
Appendix D: Locking in Form Builder
......................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
D-20 Oracle iDS Forms: Build Internet Applications I
................................
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
Appendix E: Oracle8 Object Features
......................................................................................................................................................
Objectives
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
E-2 Oracle 9iDS Forms: 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
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I E-3
Appendix E: Oracle8 Object Features
......................................................................................................................................................
• NCHAR
• NVARCHAR2
• FLOAT
• NLS types
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
E-4 Oracle 9iDS Forms: 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.
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I E-5
Appendix E: Oracle8 Object Features
......................................................................................................................................................
Object Types
Attributes
Ship
ORDER
po_no Cancel
Check custinfo
status line_items
amount
Hold
Methods
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
E-6 Oracle 9iDS Forms: Build Internet Applications I
Oracle8 Datatypes
......................................................................................................................................................
Object Types
An object type is a user-defined composite datatype. Oracle8 requires enough
knowledge of a user-defined datatype to interact with it. Thus, in some sense an object
type is similar to a record type, and in some sense it is similar to a package.
An object type must have one or more attributes and can contain methods.
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I E-7
Appendix E: Oracle8 Object Features
......................................................................................................................................................
Object Types
Attributes
Ship
ORDER
po_no Cancel
Check custinfo
status line_items
amount
Hold
Methods
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
E-8 Oracle 9iDS Forms: Build Internet Applications I
Oracle8 Datatypes
......................................................................................................................................................
Methods An object type is also similar to a package. Once an object is declared, its
attributes are similar to package variables. Like packages, object types can contain
procedures and functions. In object types, these subprograms are known as methods. A
method describes the behavior of an object type.
Like packages, object types can be declared in two parts: a specification and a body.
As with package variables, attributes declared in the object type specification are
public and those declared in the body are private. As with package subprograms, all
methods are defined in the package body, but only those whose specification appears
in the object type specification are public methods.
Here is an example of an object type:
CREATE TYPE dept_type AS OBJECT
(dept_idNUMBER(2),
dnameVARCHAR2(14),
loc VARCHAR2(3),
MEMBER PROCEDURE set_dept_id (d_id NUMBER),
PRAGMA RESTRICT_REFERENCES (set_dept_id,
RNDS,WNDS,RNPS,WNPS),
MEMBER FUNCTION get_dept_id RETURN NUMBER,
PRAGMA RESTRICT_REFERENCES (get_dept_id,
RNDS,WNDS,RNPS,WNPS));
CREATE TYPE BODY dept_type AS
MEMBER PROCEDURE set_dept_id (d_id NUMBER)
IS
BEGIN
dept_id := d_id;
nly
END;
MEMBER FUNCTION get_dept_id
e O
RETURN NUMBER
Us
I
IS
A
BEGIN
RETURN (dept_id);
END;
& O
END;
al
ern
Int
le
rac
O
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I E-9
Appendix E: Oracle8 Object Features
......................................................................................................................................................
Object Tables
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
E-10 Oracle 9iDS Forms: Build Internet Applications I
Creating Oracle8 Objects
......................................................................................................................................................
Object Tables
One way to create an object is to create a table whose rows are objects of that object
type. Here is an example of an object table declaration:
CREATE TABLE o_dept OF dept_type;
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.
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I E-11
Appendix E: Oracle8 Object Features
......................................................................................................................................................
Object Columns
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
E-12 Oracle 9iDS Forms: Build Internet Applications I
Creating Oracle8 Objects
......................................................................................................................................................
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.
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I E-13
Appendix E: Oracle8 Object Features
......................................................................................................................................................
Object Views
Object
Object-oriented view Relational
application table
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
E-14 Oracle 9iDS Forms: Build Internet Applications I
Creating Oracle8 Objects
......................................................................................................................................................
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 object-
relational 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
y
FROM emp e;
nl
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I E-15
Appendix E: Oracle8 Object Features
......................................................................................................................................................
INSTEAD-OF Triggers
DECLARE
BEGIN
EXCEPTION
END;
Nonupdatable INSTEAD-OF
view Trigger
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
E-16 Oracle 9iDS Forms: Build Internet Applications I
Creating Oracle8 Objects
......................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I E-17
Appendix E: Oracle8 Object Features
......................................................................................................................................................
References to Objects
OID
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
E-18 Oracle 9iDS Forms: 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,
y
sal NUMBER(7,2),
comm NUMBER(7,2),
nl
O
dept REF dept_type SCOPE IS o_dept) ;
e
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.
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I E-19
Appendix E: Oracle8 Object Features
......................................................................................................................................................
nly
e O
Us
AI
& O
al Copyright Oracle Corporation, 2000. All rights reserved.
ern
Int
le
rac
O
......................................................................................................................................................
E-20 Oracle 9iDS Forms: Build Internet Applications I
Displaying Oracle8 Objects in the Object Navigator
......................................................................................................................................................
Object Types
Both the attributes and the methods are listed under each type. Also, the nested types
within address_and_phone_type are displayed in an indented sublevel.
This convention is used for nested object and object type displays throughout Oracle
Developer.
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I E-21
Appendix E: Oracle8 Object Features
......................................................................................................................................................
nly
e O
Us
AI
& O
al Copyright Oracle Corporation, 2000. All rights reserved.
ern
Int
le
rac
O
......................................................................................................................................................
E-22 Oracle 9iDS Forms: Build Internet Applications I
Displaying Oracle8 Objects in the Object Navigator
......................................................................................................................................................
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.
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I E-23
Appendix E: Oracle8 Object Features
......................................................................................................................................................
nly
e O
Us
AI
& O
al Copyright Oracle Corporation, 2000. All rights reserved.
ern
Int
le
rac
O
......................................................................................................................................................
E-24 Oracle 9iDS Forms: Build Internet Applications I
Displaying Oracle8 Objects in the Object Navigator
......................................................................................................................................................
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.
Reference For more information about INSTEAD-OF triggers, see Oracle8 Server
SQL Reference Manual and Oracle8 Concepts Manual.
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I E-25
Appendix E: Oracle8 Object Features
......................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
E-26 Oracle 9iDS Forms: Build Internet Applications I
Displaying Oracle8 Objects in the Object Navigator
......................................................................................................................................................
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.
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I E-27
Appendix E: Oracle8 Object Features
......................................................................................................................................................
Summary
Summary
ern
Int
le
rac
O
......................................................................................................................................................
E-28 Oracle 9iDS Forms: 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.
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
Oracle Forms Developer: Build Internet Applications I E-29
Appendix E: Oracle8 Object Features
......................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
E-30 Oracle 9iDS Forms: Build Internet Applications I
................................
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
Appendix F: Using the Layout Editor
......................................................................................................................................................
Objectives
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
F-2 Oracle iDS Forms: 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
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
Oracle iDS Forms: 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
nly
e O
Us
AI
& O
al Copyright Oracle Corporation, 2000. All rights reserved.
ern
Int
le
rac
O
......................................................................................................................................................
F-4 Oracle iDS Forms: Build Internet Applications I
Why Use the Layout Editor?
......................................................................................................................................................
Layout Types
You can use the Layout Editor to control the visual layout in Oracle Forms Developer
and Oracle Reports Developer. The surfaces include:
• Canvas views in Forms
A canvas is the surface on which you arrange a form’s objects. Its view is the
portion of that canvas that is initially visible in a window at run time. You can also
see stacked or tabbed canvas views in the Layout Editor; their views might overlay
others in the same window. You can also display stacked views in the Layout
Editor.
nly
• Layouts in Reports
e O
s
Here, the Layout Editor lets you plan the format of a report. This includes the
U
I
frame structure of the report, as well as buttons, graphics, and background text
(boilerplate).
OA
l &
rna
nte
e I
l
rac
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications I F-5
Appendix F: Using the Layout Editor
......................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
F-6 Oracle iDS Forms: Build Internet Applications I
How to Access the Layout Editor
......................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications I F-7
Appendix F: Using the Layout Editor
......................................................................................................................................................
5 2
4
Copyright Oracle Corporation, 2000. All rights reserved.
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
F-8 Oracle iDS Forms: Build Internet Applications I
Components of the Layout Editor
......................................................................................................................................................
e O
s
• Layout/Painting region
U
This is the main central/right area where you can place and manipulate objects. A
I
A
grid pattern is displayed in this area to aid alignment of objects. You can switch off
O
or rescale this grid if required (in Forms, the grid is hidden if the View—>Show
&
Canvas option is switched on).
• Status line
al
rn
This appears at the bottom of the window. It shows you the mouse position and
e
nt
drag distance (when moving objects) and the current magnification level.
e I
l
rac
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications I F-9
Appendix F: Using the Layout Editor
......................................................................................................................................................
Tool Palette
1
2 8
3 9
4 10
5 11
6 12
7 13
1 Select 8 Rotate
2 Magnify 9 Reshape
3 Rectangle 10 Line
4 Ellipse 11 Arc
5 Polygon 12 Polyline
y
6 Rounded rectangle 13 Freehand
7 Text
nl
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
F-10 Oracle iDS Forms: Build Internet Applications I
Creating and Modifying Objects in the Layout
......................................................................................................................................................
n
Note: You can produce constrained shapes (for example, a circle instead of an ellipse)ly
by pressing the [Shift] key during step 2.
e O
Creating Text
Us
AI
The Text tool (T) lets you open a Boilerplate Text object on the layout. You can type
O
one or more lines of text into this object while it is selected with the Text tool. Uses of
&
text objects vary according to the Oracle Developer tool in which you create them.
al
ern
Int
le
rac
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications I F-11
Appendix F: Using the Layout Editor
......................................................................................................................................................
Selecting Objects
Manipulating Objects
Expand/contract
in one direction
nly
e O
Us
A
Expand/contract
I
O
diagonally
l &
a
Copyright Oracle Corporation, 2000. All rights reserved.
ern
Int
le
rac
O
......................................................................................................................................................
F-12 Oracle iDS Forms: Build Internet Applications I
Creating and Modifying Objects in the Layout
......................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
F-14 Oracle iDS Forms: Build Internet Applications I
Creating and Modifying Objects in the Layout
......................................................................................................................................................
A Note on Grid-Snap Alignment You can ensure that all objects that you move
align with snap points that are defined on the grid. To activate these, select
View—>Snap to Grid from the menu. You can also use the View options to change the
grid-snap spacing and units.
Note: If you position an object using one grid-snap spacing, and then try to position
other objects under different settings, it may prove difficult to align them with each
other.
Try to stick to the same snap units, if you use grid-snap at all.
Overlapping Objects
You can position objects on top of each other. If they are transparent, then one object
can be seen through another (this is explained in detail later in this lesson).
y
Change the stacking order of overlapping objects by selecting the object to move and
then choosing the following as required, from the Arrange menu:
nl
• Bring to Front
e O
s
• Send to Back
• Move Forward
I U
• Move Backward
OA
l &
rna
nte
e I
l
rac
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications I F-15
Appendix F: Using the Layout Editor
......................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
F-16 Oracle iDS Forms: Build Internet Applications I
Creating and Modifying Objects in the Layout
......................................................................................................................................................
ly
zoom position on the layout region. [Shift] + click reduces
n
magnification.
Note: You can undo your previous action in the current Layout Editor session by
e O
s
selecting Edit—>Undo from the menu.
I U
OA
l &
rna
nte
e I
l
rac
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications I F-17
Appendix F: Using the Layout Editor
......................................................................................................................................................
Format Menu
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
F-18 Oracle iDS Forms: Build Internet Applications I
Formatting Objects in the Layout
......................................................................................................................................................
e
Format menu itself. Font settings are ignored if the application is run in character
mode.
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications I F-19
Appendix F: Using the Layout Editor
......................................................................................................................................................
2
3
4
1 Sample window
2 Fill color/pattern
3 Line color
4 Text color
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
F-20 Oracle iDS Forms: Build Internet Applications I
Coloring Objects and Text
......................................................................................................................................................
Coloring Objects
You can separately color the fill area (body) of an object and its boundary line (a line
object has no body).
Coloring an Area
1 Select the objects whose color you want to change.
2 Select the Fill Color tool. The color palette appears.
If you want the objects to become transparent, select No Fill at the
bottom of the color palette window.
3 Select a color from those visible. If you want the fill area to be patterned
instead of plain, then select Patterns from the bottom of the color palette,
and follow the next step.
4 If you select Patterns, another window appears with patterns for you to
choose. Select one. You can define separate colors for the two shades of
the pattern by selecting the pattern color buttons at the bottom of the Fill
Pattern palette; each button opens a further color palette.
Coloring a Line
nly
1 With the desired layout objects selected, click the Line Color tool. The
e O
color palette opens.
Us
2 Select the color for lines and bounding lines from this color palette.
Select No Line at the bottom of this window to remove the objects’
AI
boundary lines.
& O
l
Note: If you set both No Fill and No Line, the affected objects become invisible.
rna
nte
e I
l
rac
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications I F-21
Appendix F: Using the Layout Editor
......................................................................................................................................................
2
3
4
1 Sample window
2 Fill color/pattern
3 Line color
4 Text color
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
F-22 Oracle iDS Forms: Build Internet Applications I
Coloring Objects and Text
......................................................................................................................................................
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.
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications I F-23
Appendix F: Using the Layout Editor
......................................................................................................................................................
Importing Images
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
F-24 Oracle iDS Forms: Build Internet Applications I
Importing Images and Drawings
......................................................................................................................................................
Importing Drawings
You can import line art onto the layout from either the file system or the database.
Select File—>Import—>Drawing from the menus, and specify the source in the
Import dialog box. The format can be Oracle or a CGM file.
Importing Images
Select File—>Import—>Image from the menus, and set the Import Image options:
Option Description
(Radio buttons) File/Database Where to import from
Filename File to be imported
Format Image format (BMP, TIFF, PCX, PICT, GIF, CALS,
RAS, Oracle Format, and PCD [Kodak Photo CD])
Quality Range from Excellent to Poor. This is a trade-off
between image resolution and memory required.
mode (while pressing the [Shift] key) so the image does not become distorted.
se
it like other objects on the layout. It is usually better to resize images in Constrained
I U
OA
l &
rna
nte
e I
l
rac
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications I F-25
Appendix F: Using the Layout Editor
......................................................................................................................................................
Summary
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
F-26 Oracle iDS Forms: Build Internet Applications I
Summary
......................................................................................................................................................
Summary
• You can create objects by:
- Choosing the correct toolbar tool
- Clicking and dragging the layout region
• There are color palette tools for fill area, lines, and text.
• View, Arrange, and Format menus are available while you are in the
Layout Editor.
• You can group objects for operations.
• You can import images and drawings by selecting Edit—>Import.
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications I F-27
Appendix F: Using the Layout Editor
......................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
F-28 Oracle iDS Forms: Build Internet Applications I
................................
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
Appendix G: Introduction to Query Builder
.....................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
G-2 Oracle iDS Forms: Build Internet Applications I
What Is Query Builder?
.....................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications I G-3
Appendix G: Introduction to Query Builder
.....................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
G-4 Oracle iDS Forms: Build Internet Applications I
What Is Query Builder?
.....................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications I G-5
Appendix G: Introduction to Query Builder
.....................................................................................................................................................
2 3
1 Toolbar
2 Conditions panel
3 Datasource panel
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
G-6 Oracle iDS Forms: Build Internet Applications I
The Query Builder Window
.....................................................................................................................................................
Toolbar
The toolbar enables you to issue commands with a click of the mouse. You can create
conditions, add new datasources, or define new columns.
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications I G-7
Appendix G: Introduction to Query Builder
.....................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
G-8 Oracle iDS Forms: Build Internet Applications I
Building a New Query
.....................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications I G-9
Appendix G: Introduction to Query Builder
.....................................................................................................................................................
Datasource Components
1 5
2
6
3
7
4 8
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
G-10 Oracle iDS Forms: 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 Description
Table Stores data in the database.
View 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.
Synonym 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.
Alias 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.
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications I G-11
Appendix G: Introduction to Query Builder
.....................................................................................................................................................
Refining a Query
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
G-12 Oracle iDS Forms: 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.
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications I G-13
Appendix G: Introduction to Query Builder
.....................................................................................................................................................
Sorting Data
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
G-14 Oracle iDS Forms: 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.
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications I G-15
Appendix G: Introduction to Query Builder
.....................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
G-16 Oracle iDS Forms: Build Internet Applications I
Viewing and Saving Queries
.....................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications I G-17
Appendix G: Introduction to Query Builder
.....................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
G-18 Oracle iDS Forms: Build Internet Applications I
Including Additional Tables
.....................................................................................................................................................
se
U
3 Select the name of the database in the list and then click Open, or simply double-
click the account name.
AI
O
4 Follow the normal procedure for including tables in the Query window.
l &
rna
nte
e I
l
rac
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications I G-19
Appendix G: Introduction to Query Builder
.....................................................................................................................................................
Viewing Comments
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
G-20 Oracle iDS Forms: Build Internet Applications I
Including Additional Tables
.....................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications I G-21
Appendix G: Introduction to Query Builder
.....................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
G-22 Oracle iDS Forms: 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.
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications I G-23
Appendix G: Introduction to Query Builder
.....................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
G-24 Oracle iDS Forms: Build Internet Applications I
Relationships
.....................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications I G-25
Appendix G: Introduction to Query Builder
.....................................................................................................................................................
Unmatched Rows
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
G-26 Oracle iDS Forms: Build Internet Applications I
Relationships
.....................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications I G-27
Appendix G: Introduction to Query Builder
.....................................................................................................................................................
Conditions
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
G-28 Oracle iDS Forms: Build Internet Applications I
Selecting Rows with Conditions
.....................................................................................................................................................
I U
The Toolbar
OA
&
The logical operators and the Accept and Cancel tools in the toolbar are active
l
whenever the Condition field is active. You can insert an operator from the toolbar
a
n
into the condition by clicking it.
er
Int
le
rac
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications I G-29
Appendix G: Introduction to Query Builder
.....................................................................................................................................................
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
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
G-30 Oracle iDS Forms: 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 Usage
= Equal
<> Not equal
< Less than
nly
O
<= Less than or equal
e
> Greater than
>= Greater than or equal
Us
I
BETWEEN... Between two values
AND...
IN (LIST) Equal to any member of the following list
OA
IS NULL
l &
Is a NULL value. A row without a value in one column is said to contain a
a
NULL value.
ern
Int
le
rac
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications I G-31
Appendix G: Introduction to Query Builder
.....................................................................................................................................................
Multiple Conditions
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
G-32 Oracle iDS Forms: Build Internet Applications I
Entering Multiple Conditions
.....................................................................................................................................................
&
l
panel and combines them with the operator that you specified.
rna
nte
e I
l
rac
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications I G-33
Appendix G: Introduction to Query Builder
.....................................................................................................................................................
Deactivating a Condition
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
G-34 Oracle iDS Forms: 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.
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications I G-35
Appendix G: Introduction to Query Builder
.....................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
G-36 Oracle iDS Forms: Build Internet Applications I
Defining Columns Using an Expression
.....................................................................................................................................................
Us
How to Display and Hide Defined Columns
AI
do ordinary columns.
& O
You display or hide defined columns from a query in exactly the same manner as you
al
ern
Int
le
rac
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications I G-37
Appendix G: Introduction to Query Builder
.....................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
G-38 Oracle iDS Forms: Build Internet Applications I
Defining Columns Using a Function
.....................................................................................................................................................
What Is a Function?
A function is similar to an operator in that it performs a calculation and returns a
result. Functions consist of a function name followed by parentheses, in which you
indicate the arguments.
An argument is an expression that supplies information for the function to use.
Functions usually include at least one argument, most commonly the name of the
column on which the operation will be performed.
Single-Row Functions
• Return one value for every data row operated on
• Examples: INITCAP(), SUBSTR(), TRUNC()
Aggregate Functions
• Return a single row based on the input of multiple rows of data
• Examples: AVG(), COUNT(), SUM()
Us
I
5 Select the Paste Arguments check box (optional).
Note: If this check box is selected, a description or datatype name of the
OA
arguments appropriate for the function is pasted into your expression. You then
replace the description with the actual arguments.
l &
rna
6 Click OK to paste the function into your expression and return to the Define
Columns dialog box.
nte
e I
l
rac
O
......................................................................................................................................................
Oracle iDS Forms: Build Internet Applications I G-39
Appendix G: Introduction to Query Builder
.....................................................................................................................................................
nly
e O
Us
AI
& O
al
ern
Int
le
rac
O
......................................................................................................................................................
G-40 Oracle iDS Forms: Build Internet Applications I