Documente Academic
Documente Profesional
Documente Cultură
Build Forms II
.......................................................................................
44112GC10
Production 1.0
May 1999
M08752
Author Copyright Oracle Corporation, 1999. All rights reserved.
Mark Doran If this documentation is delivered to a U.S. Government Agency not within the
Department of Defense, then it is delivered with “Restricted Rights,” as defined in
Gillian Elias
FAR 52.227-14, Rights in Data-General, including Alternate III (June 1987).
Tushar Gadhia
The information in this document is subject to change without notice. If you find
Stephen Gramann any problems in the documentation, please report them in writing to Education
Nancy Greenberg Products, Oracle Corporation, 500 Oracle Parkway, Box 659806, Redwood
Ursula Hovy Shores, CA 94065. Oracle Corporation does not warrant that this document is
error-free.
Uwe Jentzsch
Oracle Developer, Oracle Server, and PL/SQL are trademarks or registered
Leta A. Johnson
trademarks of Oracle Corporation.
Jan Keuben
All other products or company names are used for identification purposes only,
Steve Lirette and may be trademarks of their respective owners.
Jayne Marlow
Rita Morin
Daphne Nougier
Christin Nowakowski
Bryan Roberts
Bert Salyga
Helene Schwann
Hiroyuki Sugiyama
Pal Tarcsay
Bart Van der Laar
Jack Walsh
Publisher
Kelly Lee
Sherry Polm
Contents
.....................................................................................................................................................
Preface
Profile xv
Related Publications xvi
Typographic Conventions xvii
.....................................................................................................................................................
Oracle Developer: Build Forms II iii
Contents
.....................................................................................................................................................
.....................................................................................................................................................
iv Oracle Developer: Build Forms II
Contents
.....................................................................................................................................................
.....................................................................................................................................................
Oracle Developer: Build Forms II v
Contents
.....................................................................................................................................................
.....................................................................................................................................................
vi Oracle Developer: Build Forms II
Contents
.....................................................................................................................................................
.....................................................................................................................................................
Oracle Developer: Build Forms II vii
Contents
.....................................................................................................................................................
.....................................................................................................................................................
viii Oracle Developer: Build Forms II
Contents
.....................................................................................................................................................
.....................................................................................................................................................
Oracle Developer: Build Forms II ix
Contents
.....................................................................................................................................................
.....................................................................................................................................................
x Oracle Developer: Build Forms II
Contents
.....................................................................................................................................................
Summary C-35
.....................................................................................................................................................
Oracle Developer: Build Forms II xi
Contents
.....................................................................................................................................................
.....................................................................................................................................................
xii Oracle Developer: Build Forms II
A
................................
Practice Solutions
Appendix A: Practice Solutions
......................................................................................................................................................
Practice 1 Solutions
1 Create a connection to the database.
Create a new connection.
a
File––>New––>Connection
b Name the connection SUMMIT and specify the connect string. Your
instructor should provide this information.
Enter the title, username, password, and database.
2 Create an initial project.
a Create a new project (use the Project Wizard).
Tools––>Project Wizard
b Name the project “Oracle Developer: Build Forms II”. Assign to this
project the connection created earlier, and save it as summit.upd in
the Lab directory. Do not add files to this project.
Enter a Project Registry Filename of summit.upd in the Lab
subdirectory and click Next. Enter a Title of Oracle Developer:
Build Forms II. Enter a Project Directory of the Lab
subdirectory and click Next. Select Summit as the Pre-Defined
Connection and click Next. Click Next to skip the Author and
Comments fields. Select “Create an empty project” and click
Finish.
3 Create a subproject and add files to it.
a Using the Project Wizard, create a subproject named Summit
Application that belongs to Oracle Developer: Build Forms II.
Select the project node in the Project Navigator. Select Tools
––>Project Wizard in the main menu. Select “Create a sub-
project under an existing project” and click Next. Click Next to
accept Oracle Developer: Build Forms II as the Parent Project.
Enter Summit Application as the Title. Enter the Lab
subdirectory as the Project Directory and click Next. Select
Summit as the Pre-Defined Connection and click Next. Click
Next to skip the Author and Comments fields.
b From the labs directory, add:
- baseball.tif
- calendar.pll
- copy.ico
......................................................................................................................................................
A-2 Developer/2000: Build Forms II
Practice 1 Solutions
......................................................................................................................................................
-
customers.fmb
-
Form_Builder_II.olb
-
pr11_2f.txt
-
pr7_3a.sql
Click Finish to accept “Select files to add to a project.” The “Add
Files to Project” dialog box appears. Select the files and press
Enter.
c Give a file items a more meaningful title.
In the Project Navigator, select the pr11_2f.txt file and change
the name of its entry to Delete Record Group Script. Examine
the Property Palette for the item and note that the Filename
property has not changes.
4 Explore the Project Navigator.
a Examine the state of the Project Navigator. Note that Project Builder
has added executable versions of the Oracle source files that you
added to the project.
There is no formal solution.
b Turn off the Show Implicit Items option. Note what happens to the
Project Navigator display.
Select Tools––>Preferences––>Navigator and clear the Show
Implied Items check box.
c Experiment with Project Builder’s different views.
Select the different views under the Navigator menu.
5 Deliver the project.
a Invoke the Delivery Wizard and deliver all files.
Select Tools––>Deliver Wizard from the main menu. Select the
name of the project from the list, select the “Deliver all files”
option, and click the Next button.
b Create Oracle Installer scripts on your local file system.
Select the “Deliver locally and create Oracle Installer scripts”
option, enter the destination subdirectory, and click on the Next
button. Name the Script Summit_Install, and use the Summit
program group. Do not ship the Oracle Developer Runtime
environment with the installation. Click the Next button to
continue.
......................................................................................................................................................
Developer/2000: Build Forms II A-3
Appendix A: Practice Solutions
......................................................................................................................................................
......................................................................................................................................................
A-4 Developer/2000: Build Forms II
Practice 2 Solutions
......................................................................................................................................................
Practice 2 Solutions
1 Create a new menu module.
a Using the following screenshot as a guideline, create a new menu
module called M_SUMMIT.
Select the Menus node in the Object Navigator and click the
Create tool.
Invoke the Menu Editor. This automatically creates the main
menu. Change the name of the menu to MAIN_MENU.
Rename the menu item New Item to File. Click New Item twice
to obtain the text cursor. Erase the old name. Enter the name:
File.
Create new menu items under File. Click File. Click the Create
Down tool. Change the name. Set the properties as follows:
......................................................................................................................................................
Developer/2000: Build Forms II A-5
Appendix A: Practice Solutions
......................................................................................................................................................
• File Menu
Visible in
Menu Visible Horiz.
Item Command Menu Item in Menu Icon
Label Type Type Code Menu Toolbar Filename
Save Plain PL/SQL DO_KEY(’CO Yes Yes Save
MMIT_FORM’
);
Clear Plain PL/SQL DO_KEY(’ Yes Yes Abort
CLEAR_FORM
’);
Null1 Separator Null Yes Yes
Exit Plain PL/SQL DO_KEY( Yes Yes Exit
’EXIT_FORM
’);
Null2 Separator Null No Yes
Note the exact names of the Main Menu, and each its menu
items. These will be needed in a later exercise.
Create a new menu item to the right of File and rename it Edit.
Click the File menu item.
Click the Create Right tool.
Name the new menu item Edit.
Create new menu items under Edit. Click Edit. Click the Create
Down tool. Change the name. For each of the items, set the
properties as follows:
• Edit Menu
Visible in
Menu Magic Command Visible Horiz. Menu Icon
Label Item Type Item Type in Menu Toolbar Filename
Cut Magic Cut Null Yes Yes Cut
Copy Magic Copy Null Yes Yes Copy
......................................................................................................................................................
A-6 Developer/2000: Build Forms II
Practice 2 Solutions
......................................................................................................................................................
Visible in
Menu Magic Command Visible Horiz. Menu Icon
Label Item Type Item Type in Menu Toolbar Filename
Paste Magic Paste Null Yes Yes Paste
Null3 Separator Null No Yes
Create a new menu item to the right of Edit and rename it Sort
By. Click Edit. Click the Create Right tool. Rename the new
menu item Sort By.
Create three new menu items under Sort By. Click Sort By. Click
the Create Down tool. Change the name. Set additional
properties as follows:
• Sort By Menu
......................................................................................................................................................
Developer/2000: Build Forms II A-7
Appendix A: Practice Solutions
......................................................................................................................................................
• Query Menu
Visible in
Menu Command Horiz. Menu Icon
Label Item Type Type Menu Item Code Toolbar Filename
Enter Plain PL/SQL DO_KEY(’ Yes query
Query ENTER_QUERY’);
eXe- Plain PL/SQL DO_KEY(’EXECUT Yes execute
cute E_QUERY’);
Query
......................................................................................................................................................
A-8 Developer/2000: Build Forms II
Practice 3 Solutions
......................................................................................................................................................
Practice 3 Solutions
1 Define a check menu item.
a Open the M_SUMMIT menu module and create a new menu item to
the right of Query and rename it Image.
See previous solution.
b Create a new menu item under Image and name it Image Activate.
See previous solution.
Set the properties as follows:
c Import the text for the Image Activate menu item by using the
pr3_1c.txt file. The menu item name must be
IMAGE_ACTIVATE.
In the PL/SQL Editor, select File->Import Text. Import the
H:\Lab\pr3_1c.txt file.
DECLARE
product_image_id ITEM := FIND_ITEM(’s_item.product_image’ );
image_description_id ITEM := FIND_ITEM(’s_item.image_description’);
image_button_id ITEM := FIND_ITEM(’control.image_button’ );
BEGIN
IF GET_ITEM_PROPERTY(product_image_id,displayed) = ’TRUE’ THEN
SET_ITEM_PROPERTY( product_image_id, DISPLAYED,
PROPERTY_FALSE);
SET_ITEM_PROPERTY( image_description_id, DISPLAYED,
PROPERTY_FALSE );
SET_ITEM_PROPERTY( image_button_id, LABEL, ’Image On’);
SET_MENU_ITEM_PROPERTY( ’image_menu.image_activate’, CHECKED,
PROPERTY_FALSE );
ELSE
SET_ITEM_PROPERTY(product_image_id, DISPLAYED, PROPERTY_TRUE );
SET_ITEM_PROPERTY(image_description_id, DISPLAYED,
PROPERTY_TRUE );
SET_ITEM_PROPERTY(image_button_id, LABEL, ’Image Off’);
SET_MENU_ITEM_PROPERTY(’image_menu.image_activate’, CHECKED,
PROPERTY_TRUE );
END IF;
......................................................................................................................................................
Developer/2000: Build Forms II A-9
Appendix A: Practice Solutions
......................................................................................................................................................
END;
......................................................................................................................................................
A-10 Developer/2000: Build Forms II
Practice 3 Solutions
......................................................................................................................................................
THEN
SET_MENU_ITEM_PROPERTY(’IMAGE_MENU.IMAGE_ACTIVATE’, CHECKED,
PROPERTY_TRUE );
END IF;
c Save and compile the module.
d Run the CUSTOMERS form and test your application.Execute a
Query and click the Orders button to move to the ORDERS form.
Note that the Sort By and Image menu items are disabled when the
CUSTOMERS form is current, and that they are enabled when the
ORDERS form is current.
......................................................................................................................................................
Developer/2000: Build Forms II A-11
Appendix A: Practice Solutions
......................................................................................................................................................
Practice 4 Solutions
1 Create and modify a key trigger.
a Open the ORDERS form module and replace the M_SUMMIT menu
module with the DEFAULT&SMARTBAR menu.
b Run the form and make sure that you understand the default behavior
of [Duplicate Record], by invoking it once while the cursor is on a
queried record in the S_ORD block and again when the cursor is on a
new record.
c Redefine [Duplicate Record] so that a new record is created before
the record duplication occurs. Redefine [Duplicate Record] at the
form level.
......................................................................................................................................................
A-12 Developer/2000: Build Forms II
Practice 4 Solutions
......................................................................................................................................................
b Test whether you can exit from the form by selecting the [Exit] key
in the master block.
You cannot exit the form by selecting the [Exit] key in the master
block.
......................................................................................................................................................
Developer/2000: Build Forms II A-13
Appendix A: Practice Solutions
......................................................................................................................................................
d Test again whether you can exit from the form by selecting [Exit] in
the master block. Explain this behavior.
If there is no key trigger defined for a function key at the same
level as Key-Others, Forms searches at a higher level for such a
key trigger.
......................................................................................................................................................
A-14 Developer/2000: Build Forms II
Practice 4 Solutions
......................................................................................................................................................
......................................................................................................................................................
Developer/2000: Build Forms II A-15
Appendix A: Practice Solutions
......................................................................................................................................................
Practice 5 Solutions
In this practice, you provide additional functionality in your forms by
defining mouse-event triggers.
1 In the CUSTOMERS form, define a mouse-event trigger on
S_CUSTOMER.COMMENTS that invokes the item’s editor when the
user double-clicks the item.
WHEN-MOUSE-DOUBLECLICK on s_customer.comments
EDIT_TEXTITEM;
......................................................................................................................................................
A-16 Developer/2000: Build Forms II
Practice 5 Solutions
......................................................................................................................................................
6 Save, compile, and run the ORDERS form to test. The stacked canvas,
CV_HELP is displayed only if the current item is not obscured. Ensure,
at least, that the first entered item in the form is CV_HELP will not
obscure.
You might decide to advertise Help only while the cursor is in
certain items, or move the stacked canvas to a position that does not
overlay enterable items.
The CV_HELP canvas, of course, could also be shown in its own
window, if appropriate.
......................................................................................................................................................
Developer/2000: Build Forms II A-17
Appendix A: Practice Solutions
......................................................................................................................................................
Practice 6 Solutions
1 Manipulate a multiple-window form.
a Open the ORDERS form module.
b Make sure that when a user closes the orders window by way of the
system-menu box, the form is exited. Also make sure that when a
user closes the inventory window by way of the system-menu box,
the cursor navigates to the orders window. If cursor navigation
succeeds, the inventory window should closed. Create a When-
Window-Closed trigger. You can import the pr6_1b.txt file.
......................................................................................................................................................
A-18 Developer/2000: Build Forms II
Practice 6 Solutions
......................................................................................................................................................
......................................................................................................................................................
Developer/2000: Build Forms II A-19
Appendix A: Practice Solutions
......................................................................................................................................................
......................................................................................................................................................
A-20 Developer/2000: Build Forms II
Practice 7 Solutions
......................................................................................................................................................
Practice 7 Solutions
1 Base the EMP block on a subquery.
a Open the EMPLOYEES form module.
b Set the Query Data Source Type EMP block property to From Clause
Query.
In the EMP block Property Palette, under the Database node,
change Query Data Source Type to From Clause Query.
c In the Query Data Source Name property enter the SELECT
statement. Your query should return all the columns from the S_EMP
table joined with the columns from the S_DEPT table. Remember to
enclose your select SELECT statement in parentheses. You can copy
and paste the content of the pr7_1c.txt file.
The SELECT statement is:
(SELECT e.ID,
USERID,
LAST_NAME,
FIRST_NAME,
START_DATE,
TITLE,
MANAGER_ID,
DEPT_ID,
SALARY,
COMMISSION_PCT,
COMMENTS,
d.ID NUM,
REGION_ID,
NAME
FROM s_emp e, s_dept d
WHERE e.dept_id = d.id)
......................................................................................................................................................
Developer/2000: Build Forms II A-21
Appendix A: Practice Solutions
......................................................................................................................................................
......................................................................................................................................................
A-22 Developer/2000: Build Forms II
Practice 7 Solutions
......................................................................................................................................................
e Add a trigger on the View_Type item so that the data in the Ord_Sum
block is updated when the list box value changes.
Hint: You need to execute a query in the Ord_Sum block.
Add a When-List-Changed trigger to Choose.View_Type as follows:\
GO_BLOCK(’ord_sum’);
EXECUTE_QUERY;
......................................................................................................................................................
Developer/2000: Build Forms II A-23
Appendix A: Practice Solutions
......................................................................................................................................................
5 Save and run your form. Observe the behavior of the record count in the
console and the scroll bar as you scroll through the records. What do you
deduce from this behavior?
The record count increments as Forms fetches more records, and
the scroll bar button changes size as more records are fetched. From
this we can deduce that a block based on a REF Cursor stored
procedure benefits from array fetches, just like a block based
directly on a table.
......................................................................................................................................................
A-24 Developer/2000: Build Forms II
Practice 8 Solutions
......................................................................................................................................................
Practice 8 Solutions
1 Create a block based on a relational table.
Create a new form called OO_DEPT.
a
Select Forms in the Object Navigator and click the Create
button. Select the newly created form name and change it to
OO_DEPT.
b Create a block by using the Data Block Wizard. Base the block on
the object table OO_DEPT_TABLE, and include all the columns. Do
not enforce data integrity.
Select Data Blocks in the Object Navigator and click the Create
button. Click the OK button to use the Data Block Wizard. Click
the Next button to base the new block on a table. Click the
Browse button to view a list of tables. (If you are not currently
connected to the database, you are asked to supply connect
information.) Select OO_DEPT_TABLE and click the OK
button. Click the >> button and Next button to select all the
available columns.
c Finish following the Data Block Wizard and invoke the Layout
Wizard. Select all available items for display, and use a tabular
layout with three displayed records and a scroll bar. Do not enter a
frame title.
Click the Finish button to create the block and to invoke the
Layout Wizard. Click the Next button to use a new content
canvas. Click the >> button and the Next button to select all
available items for display. Click the Next button to accept the
default prompts. Select the Tabular option button and click the
Next button to specify a tabular layout. Change the Records
Displayed value to 3, and select the Display Scrollbar check box.
Click the Next button, then the Finish button.
d Test and save the form.
There is no formal solution.
2 Create a block based on a relational table with an object column.
a Create a form called OBJ_COL.
Select Forms in the Object Navigator and click the Create
button. Select the newly created form name and change it to
OBJ_COL.
......................................................................................................................................................
Developer/2000: Build Forms II A-25
Appendix A: Practice Solutions
......................................................................................................................................................
Create a block by using the Data Block Wizard. Base the block on
b
the relational table REL_EMP_TABLE_OBJCOL. Select the
columns ID, FIRST_NAME, and LAST_NAME. Expand the object
column DEPT_ID and select the attributes ID and NAME. Note the
name that is given to the new item. Do not enforce data integrity.
Select Data Blocks in the Object Navigator and click the Create
button. Click the OK button to use the Data Block Wizard. Click
the Next button to base the new block on a table. Click the
Browse button to view a list of tables. Select
REL_EMP_TABLE_OBJCOL and click the OK button. Select
the ID column and click the > button. Repeat this process for the
FIRST_NAME and LAST_NAME columns. Expand the
DEPT_ID object column to display the objects attributes. Select
the ID attribute and click the > button. Repeat the process for
the NAME attribute. Click the Next button to continue.
c Finish following the Data Block Wizard and invoke the Layout
Wizard. Select all available items for display. Change the prompt for
item DEPT_ID to Department ID and DEPT_ID_NAME to
Department Name. Use a form layout. Do not enter a frame title.
Finish following the wizard.
Click the Finish button to create the block and to invoke the
Layout Wizard. Click the Next button to use a new content
canvas. Click the >> button and the Next button to select all
available items for display. Select the prompt for the
DEPT_ID_ID item and change it. Repeat the process for the
DEPT_ID_NAME item. Click the Next button to continue. Click
the Next button to specify a form layout. Do not enter a Frame
Title. Click the next button to accept the default records
displayed. Click the Finish button.
d Examine the properties for the item dept_id_name. Pay particular
attention to the database properties. Later, you will compare and
contrast these properties with the properties set for a REF column.
There is no formal solution.
e Test and save the form.
There is no formal solution.
3 Create a block based on a relational table with an REF column and an
LOV to populate the REF column.
......................................................................................................................................................
A-26 Developer/2000: Build Forms II
Practice 8 Solutions
......................................................................................................................................................
......................................................................................................................................................
Developer/2000: Build Forms II A-27
Appendix A: Practice Solutions
......................................................................................................................................................
Click the Finish button to create the block and to invoke the
Layout Wizard. Click the Next button to use a new content
canvas. Click the >> button and the Next button to select all
available items for display. Change the prompt for item
dept_id_id to Department Id and dept_id_name to Department
Name. Use a form layout. Do not enter a Frame Title. Finish
following the wizard.
f Examine the database properties for the item DEPT_ID_NAME. Pay
particular attention to the database properties. Notice that the Query
Only property is set to Yes.
There is no formal solution.
g Select the item DEPT_ID from the Object Navigator, and examine
the Canvas property. Also, notice that an LOV and associated record
group now exist.
There is no formal solution.
h Test and save the form, including the LOV.
There is no formal solution.
......................................................................................................................................................
A-28 Developer/2000: Build Forms II
Practice 9 Solutions
......................................................................................................................................................
Practice 9 Solutions
1 Open the ORDERS form and examine the properties of the relation
called S_ORD_S_ITEM.
a Note the deletion and coordination property values.
b Run the ORDERS form and test the way deletes are handled.
2 Implement a query coordination-type toggle.
a Add two check boxes to the control block with the following
properties:
......................................................................................................................................................
Developer/2000: Build Forms II A-29
Appendix A: Practice Solutions
......................................................................................................................................................
c Make sure that the first check box enables a user to toggle between
immediate coordination and deferred coordination. You can import
the pr9_2c.txt file.
When-Checkbox-Changed on CONTROL.IMMEDIATE
IF GET_RELATION_PROPERTY( ’s_ord_s_item’, DEFERRED_COORDINATION )
= ’FALSE’
THEN
SET_RELATION_PROPERTY(’s_ord_s_item’, DEFERRED_COORDINATION,
PROPERTY_TRUE);
SET_ITEM_PROPERTY(’control.auto_query’, ENABLED,
PROPERTY_TRUE );
ELSE
SET_RELATION_PROPERTY(’s_ord_s_item’, DEFERRED_COORDINATION,
PROPERTY_FALSE);
SET_ITEM_PROPERTY(’control.auto_query’, ENABLED,
PROPERTY_FALSE );
END IF;
d Make sure that the second check box enables a user to toggle
between automatic query and no automatic query for the detail
block. This check box should be disabled if the other check box
indicates immediate coordination. You can import the
pr9_2d.txt file.
When-Checkbox-Changed on CONTROL.AUTO_QUERY
IF GET_RELATION_PROPERTY(’s_ord_s_item’, AUTOQUERY ) = ’FALSE’
THEN
SET_RELATION_PROPERTY(’s_ord_s_item’, AUTOQUERY, PROPERTY_TRUE );
ELSE
SET_RELATION_PROPERTY(’s_ord_s_item’, AUTOQUERY, PROPERTY_FALSE);
END IF;
eTest and save the form.
There is no formal solution.
If you have time...
3 Add a detail block based on a REF relation to the OO_DEPT table.
a Open the OO_DEPT form in the Object Navigator.
There is no formal solution.
......................................................................................................................................................
A-30 Developer/2000: Build Forms II
Practice 9 Solutions
......................................................................................................................................................
Create a new block by using the Data Block Wizard. Base the block
b
on the table REL_EMP_TABLE_REFCOL, and include the id,
first_name, last_name, and dept_id REF columns. Do not enforce
data integrity, and do not create an LOV.
Select Data Blocks in the Object Navigator and click the Create
button. Click the OK button to use the Data Block Wizard. Click
the Next button to base the new block on a table. Click the
Browse button to view a list of tables. (If you are not currently
connected to the database, you are asked to supply connect
information.) Select OO_EMP_TABLE_REFCOL and click the
OK button. Select the id column and click the > button. Repeat
the process for the first_name, last_name, and dept_id REF
columns. (In the display, the entry DEPT_ID without the word
Lookup after it represents the dept_id REF column. Click the
Next button to continue.
c Create a relationship between the two blocks using the REF value.
Click the Create Relationship button. Select the block
OO_DEPT_TABLE and click the OK button. Click the Next
button to continue.
d Finish following the Data Block Wizard and invoke the Layout
Wizard. Select all available items for display, and use a tabular
layout with three displayed records and a scroll bar. Do not specify a
frame title.
Click the Finish button to create the block and to invoke the
Layout Wizard. Click the Next button to use the existing content
canvas. Click the >> button and the Next button to select all
available items for display. Click the Next button to accept the
default prompts. Select the Tabular option button and click the
Next button to specify a tabular layout. Change the Records
Displayed value to 3, and select the Display Scrollbar check box.
Click the Next button, then the Finish button.
e Test and save the form.
There is no formal solution.
4 Synchronize the check boxes at form startup.
a Open the ORDERS form module.
b Create a procedure called INIT_RELATION_CHECK_BOXES.
This procedure synchronizes the IMMEDIATE and AUTO_QUERY
......................................................................................................................................................
Developer/2000: Build Forms II A-31
Appendix A: Practice Solutions
......................................................................................................................................................
check boxes with the current default value. You can import the
pr9_4b.txt file.
PROCEDURE init_relation_check_boxes
IS
BEGIN
IF GET_RELATION_PROPERTY(’s_ord_s_item’', DEFERRED_COORDINATION) =
'FALSE'
THEN
:control.immediate := ’Y’;
SET_ITEM_PROPERTY(’control.auto_query’, ENABLED, PROPERTY_FALSE);
ELSE
:control.immediate := ’N’;
SET_ITEM_PROPERTY(’control.auto_query’, ENABLED, PROPERTY_TRUE );
END IF;
IF GET_RELATION_PROPERTY(’s_ord_s_item’, AUTOQUERY) = ’TRUE’
THEN
:control.auto_query := ’Y’;
ELSE
:control.auto_query := ’N’;
END IF;
END;
c Call this procedure from the When-New-Form-Instance trigger.
init_relation_check_boxes;
EXECUTE_QUERY;
:GLOBAL.width_win_order := GET_WINDOW_PROPERTY(’win_order’, WIDTH);
:GLOBAL.height_win_order := GET_WINDOW_PROPERTY(’win_order’,HEIGHT);
:GLOBAL.width_win_inventory := GET_WINDOW_PROPERTY(’win_inventory’,
WIDTH);
:GLOBAL.height_win_inventory := GET_WINDOW_PROPERTY(’win_inventory’,
HEIGHT);
......................................................................................................................................................
A-32 Developer/2000: Build Forms II
Practice 9 Solutions
......................................................................................................................................................
IS
CURSOR c_ord IS
SELECT ’X’
FROM s_ord
WHERE customer_id = p_cus_id;
v_dummy VARCHAR2(1);
ord_exists EXCEPTION;
BEGIN
OPEN c_ord;
FETCH c_ord INTO v_dummy;
IF c_ord%FOUND
THEN
CLOSE c_ord;
RAISE ord_exists;
ELSE
CLOSE c_ord;
END IF;
EXCEPTION
WHEN ord_exists THEN
MESSAGE(’Cannot delete customer while matching orders
exist.’);
RAISE FORM_TRIGGER_FAILURE;
END check_del_cus;
c Call the procedure when a user selects the delete function key.
......................................................................................................................................................
Developer/2000: Build Forms II A-33
Appendix A: Practice Solutions
......................................................................................................................................................
Practice 10 Solutions
1 Produce a multiple form application by linking the CUSTOMERS and
the EMPLOYEES forms.
a In the control block of the CUSTOMERS form, create a button
called EMPLOYEE_BUTTON. Place it on the CV_CUST canvas,
below the Orders button.
b Define a trigger for CONTROL.EMPLOYEE_BUTTON that calls
the EMPLOYEES form with the current sales representative ID.
- Change the Mouse Navigate property of
CONTROL.EMPLOYEE_BUTTON to No.
- Create a parameter list called SALES.
- Add the SALES_ID parameter to the parameter list. The type of this
parameter is TEXT_PARAMETER, and it is initialized with the
value of the SALES_REP_ID item.
- Invoke the EMPLOYEES form by using the CALL_FORM built-in.
You can import the pr10_1b.txt file.
......................................................................................................................................................
A-34 Developer/2000: Build Forms II
Practice 10 Solutions
......................................................................................................................................................
DEFAULT_VALUE(’’, ’GLOBAL.sales_rep_id’);
IF :GLOBAL.sales_rep_id IS NOT NULL AND :PARAMETER.sales_id IS NULL
THEN
:emp.num := :GLOBAL.sales_rep_id;
ELSE
:emp.num := :PARAMETER.sales_id;
END IF;
f Save and compile each form, then run the CUSTOMERS form
module. Test the application by exiting the EMPLOYEE form using
the menu or the toolbar.
If you have time...
2 Transaction processing for called forms:
a Make sure that any changes in the EMPLOYEES form that are
posted by a user are not rolled back by Forms upon exit.
c Save and compile each form, then run the CUSTOMERS form
module and test your application.
......................................................................................................................................................
Developer/2000: Build Forms II A-35
Appendix A: Practice Solutions
......................................................................................................................................................
Practice 11 Solutions
1 Create a dynamic list item. This functionality avoids having to create a
new item to display the department name.
a Open the EMPLOYEES form module.
There is no formal solution.
b Create a design time query record group that contains IDs and names
of departments. Name your record group DEPT_ID.
In the Object Navigator, create a record group named DEPT_ID based
on the query below:
SELECT name || ’ in region ’ || TO_CHAR(region_id) Name,
TO_CHAR(id) Id
FROM s_dept
ORDER BY 1
There is no formal solution.
c Convert the text item DEPT_ID into a list item, Combo Box Style.
Resize it in the Layout Editor.
There is no formal solution.
d Create an element in the list. Label: Dummy and Value: 0
There is no formal solution.
e Create a procedure called LIST_FROM_DESIGNTIME_GROUP.
This procedure accepts the list item name as an argument and
populates the list item dynamically at runtime, using the design-time
query record group. You can import the pr11_1e.txt file.
PROCEDURE List_From_DesignTime_Group (p_list_item IN VARCHAR2)
IS
cst_rg_nom CONSTANT VARCHAR2( 30 ) :=
GET_ITEM_PROPERTY(p_list_item, ITEM_NAME );
BEGIN
IF POPULATE_GROUP( cst_rg_nom ) = 0
THEN
POPULATE_LIST( p_list_item, cst_rg_nom );
END IF;
COPY( GET_LIST_ELEMENT_VALUE( p_list_item,1 ), p_list_item);
END List_From_DesignTime_Group;
......................................................................................................................................................
A-36 Developer/2000: Build Forms II
Practice 11 Solutions
......................................................................................................................................................
f Call the procedure each time a new record is created. You can import
the pr11_1f.txt file.
......................................................................................................................................................
Developer/2000: Build Forms II A-37
Appendix A: Practice Solutions
......................................................................................................................................................
......................................................................................................................................................
A-38 Developer/2000: Build Forms II
Practice 11 Solutions
......................................................................................................................................................
......................................................................................................................................................
Developer/2000: Build Forms II A-39
Appendix A: Practice Solutions
......................................................................................................................................................
e Create the code for the OK button. This button enables the user to
exit the form.
DO_KEY(’EXIT_FORM’);
f Create the code for the Cancel button in the PROD_LOV_BLK
block.
Create a When-Button-Pressed trigger that deletes the record group
before returning to the ITEM block. You can import the
pr11_2f.txt file.
......................................................................................................................................................
A-40 Developer/2000: Build Forms II
Practice 11 Solutions
......................................................................................................................................................
NEXT_RECORD;
EXIT WHEN :SYSTEM.LAST_RECORD = ’TRUE’;
:GLOBAL.where_cls := :GLOBAL.where_cls || ’,’';
END LOOP;
:GLOBAL.where_cls := :GLOBAL.where_cls || ’,’ ||
TO_CHAR(:item.product_id) || ’)’;
END IF;
CALL_FORM(’lov_product’, NO_HIDE);
h In the LOV_PRODUCT form, create a When-New-Form-Instance
trigger to retrieve the list of products excluding the products that
exist in the S_ITEM block. You should use the global variable
created earlier. You can import the pr11_2h.txt file.
......................................................................................................................................................
Developer/2000: Build Forms II A-41
Appendix A: Practice Solutions
......................................................................................................................................................
Practice 12 Solutions
1 Create a chart object by using the Chart Wizard. This chart should
display the total orders for each customer.
a Open the CUSTOMERS form module.
There is no formal solution.
b Create a new tab page on the TAB_CUSTOMER canvas. Name this
page CHART and change the label name.
There is no formal solution.
Open the FormBuilder_II.olb object library. Copy the
OBJ_CHART object group into the CUSTOMERS form. This object
group contains a block named S_ORD. Only one item from this
block is visible: TITLE. This item displays a title for the chart.
In the Object Navigator, double-click the icon next to the
FORM_BUILDER_II object library node.
From the Chart tab, select the OBJ_CHART object group and
drag it to the object group node in the CUSTOMERS form.
Select Copy.
c From the Layout Editor, use the Chart tool to drag a chart area onto
the chart tab page. Select Use the Chart Wizard from the New Chart
Object dialog box. Do not specify a title for the chart.
There is no formal solution.
d Select Column as chart type, Plain as chart subtype.
There is no formal solution.
e Specify the S_ORD block as the data block that contains the data
you want to assign to chart columns.
There is no formal solution.
f Select CUSTOMER_NAME to appear on the Category (X) axis, and
TOTAL to appear on the Value (Y) axis of the chart.
There is no formal solution.
g Click the Finish button. Save, run, and test your form. To display the
chart, click in the Title item on the Chart tab.
2 Create a report object based on the S_CUSTOMER block. This report
displays a customer list using a tabular layout. Display only the ID,
NAME, COUNTRY, and REGION_ID fields.
a Open the CUSTOMERS form.
......................................................................................................................................................
A-42 Developer/2000: Build Forms II
Practice 12 Solutions
......................................................................................................................................................
......................................................................................................................................................
Developer/2000: Build Forms II A-43
Appendix A: Practice Solutions
......................................................................................................................................................
......................................................................................................................................................
A-44 Developer/2000: Build Forms II
Practice 13 Solutions
......................................................................................................................................................
Practice 13 Solutions
1 Show ”About...” information at the startup of the form.
a Open the CUSTOMERS form module.
b Add a window and a canvas to the form that are used to display the
two control items. This window could be considered an ”About...”
window and should be a modal dialog window. Set the Hide on Exit
property to Yes for this window.
Create a window named ABOUT. Set the Window Style property
to Dialog. Set the Modal Property to Yes. Set both the X Position
and Y Position properties to 100.
Create a canvas named ABOUT. Set the Window property to
ABOUT.
c Create manually a new control block, called ABOUT. Create two
items in the ABOUT block that are used to display the user name and
the current date and time.
Create a content canvas named ABOUT. In the layout editor,
create two text items named user_name and client date. Create
the text items on the ABOUT canvas and in the ABOUT block.
Set the Database Item property for both items to No. Adjust the
canvas size appropriately.
d Show the ”About...” window for a short period of time at the startup
of the form. You can import the pr13_1d1.txt file for the
When-New-Form-Instance trigger. Add the new code after the
existing code. You can import the pr13_1d2.txt file for the
When-Timer-Expired trigger. Append the new code to the end of the
existing code.
......................................................................................................................................................
Developer/2000: Build Forms II A-45
Appendix A: Practice Solutions
......................................................................................................................................................
......................................................................................................................................................
A-46 Developer/2000: Build Forms II
Practice 13 Solutions
......................................................................................................................................................
......................................................................................................................................................
Developer/2000: Build Forms II A-47
Appendix A: Practice Solutions
......................................................................................................................................................
......................................................................................................................................................
A-48 Developer/2000: Build Forms II
Practice 14 Solutions
......................................................................................................................................................
Practice 14 Solutions
1 Handle errors caused by declarative constraints violations.
aOpen the CUSTOMERS form module. This form is based on the
S_CUSTOMER table. A primary key constraint is declared on the
column Id.
b Run the CUSTOMERS form and try to add a new customer with an
existing customer number. Assign the new record an Id of 201 and a
name of Dummy. What FRM-error message do you get? What
Oracle server error message do you get? (Select [Display Error] to
see the message.)
FRM-40508: ORACLE error : unable to INSERT record.
ORA-00001: unique constraint
(schema.S_CUSTOMER_ID_PK) violated.
c Which trigger must you use to trap error messages caused by
violation of this constraint?
The On-Error trigger.
d Which built-in functions must you use to get error messages caused
by violations of this constraint?
The DBMS_ERROR_CODE and DBMS_ERROR_TEXT built-
in functions.
e Trap and replace the default constraint-violation message with your
own message. Use the function STRIP_CONSTRAINT_NAME to
detect which constraint was violated. You can import the
pr14_1e1.txt file to create the function and the
pr14_1e2.txt file to replace the existing code in the trigger.
Note: The function STRIP_CONSTRAINT_NAME accepts a complete
server error message, strips away the error number and prefix, and returns a
more readable error message. The details of this function are covered in
Appendix F, “Handling Server Side Errors.”
FUNCTION strip_constraint_name
/* Strips constraint name (without schema prefix) from server-error
message. */
( p_error_text IN VARCHAR2
)
RETURN VARCHAR2
IS
v_start_pos NUMBER(4);
......................................................................................................................................................
Developer/2000: Build Forms II A-49
Appendix A: Practice Solutions
......................................................................................................................................................
v_end_pos NUMBER(4);
BEGIN -- strip_constraint_name
/* Get position of dot, starting from position of left
parenthesis. */
v_start_pos := INSTR( p_error_text, ’.’, INSTR( p_error_text,
’(’ ) );
IF v_start_pos > 0 THEN
/* Get position of right parenthesis, starting from
position of dot. */
v_end_pos := INSTR( p_error_text, ’)’, v_start_pos );
/* Return constraint name between dot and right
parenthesis. */
RETURN( SUBSTR( p_error_text, v_start_pos + 1, v_end_pos -v_
start_pos - 1 ) );
ELSE
RETURN( null );
END IF;
END strip_constraint_name;
......................................................................................................................................................
A-50 Developer/2000: Build Forms II
Practice 14 Solutions
......................................................................................................................................................
fSave and compile the form. Try to insert a duplicate Id value, and
note the displayed message.
There is no formal solution.
If you have time ...
2 Handle errors caused by stored program units.
a Open the CUSTOMERS form module.
b Implement immediate primary-key checking in the CUSTOMERS
form by creating a procedure called CHECK_PK_CUST. Call this
procedure from an appropriate trigger. You can import the
pr14_2b1.txt file to create the procedure and the
pr14_2b2.txt file to replace the existing code in the trigger.
PROCEDURE check_pk_cust
( p_cust_id IN NUMBER
, p_rowid IN VARCHAR2
)
IS
CURSOR c_cust is
SELECT 0
FROM s_customer d
WHERE d.id = p_cust_id
AND ( d.rowid <> p_rowid OR p_rowid IS NULL );
r_cust c_cust%ROWTYPE;
cust_exists EXCEPTION;
BEGIN -- check_pk_cust
OPEN c_cust;
FETCH c_cust INTO r_cust;
IF c_cust%FOUND THEN
CLOSE c_cust;
RAISE cust_exists;
ELSE
CLOSE c_cust;
END IF;
EXCEPTION
WHEN cust_exists THEN
MESSAGE( ’This customer already exists.’ );
RAISE FORM_TRIGGER_FAILURE;
END check_pk_cust;
......................................................................................................................................................
Developer/2000: Build Forms II A-51
Appendix A: Practice Solutions
......................................................................................................................................................
......................................................................................................................................................
A-52 Developer/2000: Build Forms II
Practice 14 Solutions
......................................................................................................................................................
h Which built-in functions must you use to get error messages caused
by stored procedures?
The SQLCODE and SQLERRM functions.
i Trap and replace the default error message with your own message.
Use the function STRIP_APPLICATION_ERROR to get the
application-error text. You can import the pr14_2i1.txt file to
create the function and the pr14_2i2.txt file to replace the
existing code in the trigger.
FUNCTION strip_application_error
/* Strips application-error message, without error number, from
server-error message.
This is the first error of the full server-error message. */
( p_error_text in varchar2
)
RETURN VARCHAR2
IS
v_end_pos NUMBER(4);
BEGIN -- strip_application_error
/* Get position of (second) ORA-error, starting from
position 5. */
v_end_pos := INSTR( p_error_text, ’ORA-’, 5 ) - 2;
IF v_end_pos > 0 THEN
/* Return application error message (without ORA-error
number) before next ORA-error. */
RETURN( SUBSTR( p_error_text, 12, v_end_pos - 11 ) );
else
/* Server error only contains application error; remove
ORA-error in front. */
RETURN( SUBSTR( p_error_text, 12 ) );
END IF;
END strip_application_error;
......................................................................................................................................................
Developer/2000: Build Forms II A-53
Appendix A: Practice Solutions
......................................................................................................................................................
......................................................................................................................................................
A-54 Developer/2000: Build Forms II
Practice 15 Solutions
......................................................................................................................................................
Practice 15 Solutions
1 Create a picklist by using the picklist class. This picklist enables the end
user to make selections from two lists, one showing the products
available and the other showing the objects selected.
Note: To reuse the code you wrote in practice 10 question 2, we have
provided most of the code by way of an object library.
a Create a new form module.
b Open the Form_Builder_II.olb object library.
c From the Picklist Basic tab page, drag and copy the
PICKLIST_BASIC object group to the Object Groups node in your
module and release it. Copy the object group, do not subclass the
object group. This object group contains a canvas, a window, and a
block. The block contains two buttons, with the code to return the
products selected in the picklist to the orders form.
d From the Picklist Class tab page, copy the PICKLIST object group
into your new form module. This object group contains all the
objects to implement the picklist. Organize the CONTROL block so
it is the last block in sequence.
Do this in the Object Navigator.
e Attach the picklist.pll library to your form.
f Create a When-New-Form-Instance trigger to populate the List_In.
Create an instance of the picklist with the CREATE_PICKLIST
procedure. Populate the List_in, using the
POPULATE_PICKLIST_WITH_QUERY function, with the results
of a query that returns the IDs, names, and suggested prices from the
S_PRODUCT table. (Retrieve the list of products excluding the
products that exists in the S_ITEM block. You should use the global
variable from practice 11.) Select the first element in the list by using
the SET_PICLIST_SELECTION procedure, and display both lists
by using the DISPLAY_PICKLIST procedure. You can import the
pr15_1f.txt file.
DECLARE
dummy NUMBER;
BEGIN
DEFAULT_VALUE(’’, ’GLOBAL.where_cls’);
pick_list.create_picklist;
......................................................................................................................................................
Developer/2000: Build Forms II A-55
Appendix A: Practice Solutions
......................................................................................................................................................
dummy :=
pick_list.populate_picklist_with_query(pick_list.list_in,
’SELECT name, id FROM s_product WHERE ’ || :GLOBAL.where_cls
|| ’ ORDER BY 1’);
pick_list.set_picklist_selection(pick_list.list_in, 1, NULL);
pick_list.display_picklist(pick_list.list_in);
pick_list.display_picklist(pick_list.list_out);
END;
g Save your form using the filename PickList.fmb. Compile your
form.
h Open the ORDERS form module.
i Modify the When-Button-Pressed trigger for the
CONTROL.PRODUCT_LOV_BUTTON so that it calls your new
form module. Comment out the old CALL_FORM line, it called an
LOV from an earlier lab.
. . .
CALL_FORM(’picklist’, NO_HIDE );
. . .
jSave, run, and test your form.
If you have time...
2 In the ORDERS form, add a calendar on the S_ORD.DATE_ORDERED
item and S_ORD.DATE_SHIPPED item.
a From the calendar page of the Form_Builder_II.olb object
library, copy the calendar object group.
b Attach the PL/SQL library calendar.pll, which contains the
Date_LOV package, to your module.
c Create a Key-Listval trigger on the date ordered item. Add code to
display the calendar using the Date_LOV package. You can import
the pr15_2c.txt file.
date_lov.get_date( sysdate, -- initial date
’s_ord.date_ordered’, -- return block.item
240, -- window x position
60, -- window y position
’Order Date’, -- window title
’OK’, -- ok button label
’Cancel’, -- cancel button label
TRUE, -- highlight weekend days
FALSE, -- autoconfirm selection
FALSE); -- autoskip after selection
......................................................................................................................................................
A-56 Developer/2000: Build Forms II
Practice 15 Solutions
......................................................................................................................................................
......................................................................................................................................................
Developer/2000: Build Forms II A-57
Appendix A: Practice Solutions
......................................................................................................................................................
......................................................................................................................................................
A-58 Developer/2000: Build Forms II
B
................................
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
ID
S_DEPT
.....................................................................................................................................................
B-2 Oracle Developer: Build Forms II
S_CUSTOMER Description
.....................................................................................................................................................
S_CUSTOMER Description
Column NameNull?Datatype
-----------------------------------------------------
ID NOT NULLNUMBER(7)
NAMENOT NULLVARCHAR2(50)
PHONE VARCHAR2(25)
ADDRESS VARCHAR2(400)
CITY VARCHAR2(30)
STATE VARCHAR2(20)
COUNTRYVARCHAR2(30)
ZIP_CODEVARCHAR2(75)
CREDIT_RATINGVARCHAR2(9)
SALES_REP_IDNUMBER(7)
REGION_IDNUMBER(7)
COMMENTSVARCHAR2(255)
.....................................................................................................................................................
Oracle Developer: Build Forms II B-3
Appendix B: Table Descriptions and Data
.....................................................................................................................................................
S_CUSTOMER Data
.....................................................................................................................................................
B-4 Oracle Developer: Build Forms II
S_CUSTOMER Data
.....................................................................................................................................................
.....................................................................................................................................................
Oracle Developer: Build Forms II B-5
Appendix B: Table Descriptions and Data
.....................................................................................................................................................
.....................................................................................................................................................
B-6 Oracle Developer: Build Forms II
S_CUSTOMER Data
.....................................................................................................................................................
15 rows selected.
.....................................................................................................................................................
Oracle Developer: Build Forms II B-7
Appendix B: Table Descriptions and Data
.....................................................................................................................................................
IDNAMEREGION_ID
------ ---------------------------------
10Finance1
31Sales1
32Sales2
33Sales3
34Sales4
35Sales5
41Operations1
42Operations2
43Operations3
44Operations4
45Operations5
50Administration1
12 rows selected.
.....................................................................................................................................................
B-8 Oracle Developer: Build Forms II
S_EMP Description
.....................................................................................................................................................
S_EMP Description
Column NameNull?Datatype
----------------------------------------------------
ID NOT NULLNUMBER(7)
LAST_NAMENOT NULLVARCHAR2(25)
FIRST_NAMEVARCHAR2(25)
USERIDVARCHAR2(8)
START_DATEDATE
COMMENTVARCHAR2(255)
MANAGER_IDNUMBER(7)
TITLE VARCHAR2(25)
DEPT_IDNUMBER(7)
SALARYNUMBER(11,2)
COMMISSION_PCTNUMBER(4,2)
.....................................................................................................................................................
Oracle Developer: Build Forms II B-9
Appendix B: Table Descriptions and Data
.....................................................................................................................................................
S_EMP Data
.....................................................................................................................................................
B-10 Oracle Developer: Build Forms II
S_EMP Data
.....................................................................................................................................................
.....................................................................................................................................................
Oracle Developer: Build Forms II B-11
Appendix B: Table Descriptions and Data
.....................................................................................................................................................
25 rows selected.
S_ITEM Description
Column NameNull?Datatype
-------------------------------------------------
ORD_IDNOT NULLNUMBER(7)
ITEM_IDNOT NULLNUMBER(7)
PRODUCT_IDNOT NULLNUMBER(7)
PRICE NUMBER(11,2)
QUANTITY NUMBER(9)
QUANTITY_SHIPPEDNUMBER(9)
.....................................................................................................................................................
Oracle Developer: Build Forms II B-13
Appendix B: Table Descriptions and Data
.....................................................................................................................................................
S_ITEM Data
ORD_IDITEM_IDPRODUCT_IDPRICEQUANTITYQUANTITY_SHIPPED
-------------- ----------- -------------- -----------------
100110011135500500
100210013380400400
10031002114500500
100530326582600600
1007410108250250
10063043320450450
10041002336400400
101130421161515
10134101082020
1015501694.294040
101650417802727
101750530455050
101441100453535
101240422503030
10212010828100100
1022202011234545
103130433201515
10323277971111
10412051097 7
104430421163535
10422051281212
10433032116691919
10515027322.81616
105350532472828
105250419801313
.....................................................................................................................................................
B-14 Oracle Developer: Build Forms II
S_ITEM Data
.....................................................................................................................................................
ORD_IDITEM_IDPRODUCT_IDPRICEQUANTITYQUANTITY_SHIPPED
-------------- ----------- -------------- -----------------
106120108284646
10645027322.897575
106550418759898
106650419802727
1062202011232121
1063501694.29125125
107120106115050
107320201115130130
107530421165555
10743032116697575
107220108282222
108120510999
108641080355050
108741100454242
108532861605757
10822051281818
10843277976060
10833032116698585
109110011140150150
10953042618.25500500
109750418754343
109632861605050
10943032658215001500
109210012175600600
10931002221.95300300
11015027322.891717
110250536502323
111140421652727
111241080352929
97120106910001000
9723032115005050
981404218577
9912051091818
9922051282525
99350417805353
99450530456969
112120106115050
62 rows selected.
.....................................................................................................................................................
Oracle Developer: Build Forms II B-15
Appendix B: Table Descriptions and Data
.....................................................................................................................................................
ID CUSTOMER_IDDATE_ORDEDATE_SHIPSALES_REP_IDTOTALPAYMENORDER_F
--- -------------------------------------------------------------
100 204 31-AUG9210-SEP-9211601100CREDITY
101 205 31-AUG-9215-SEP-92148056.6CREDITY
102 206 01-SEP-9208-SEP-92158335CREDITY
103 208 02-SEP-9222-SEP-9215377CASHY
104 208 03-SEP-9223-SEP-921532430CREDITY
105 209 04-SEP-92 18-SEP-92112722.24CREDITY
106 210 07-SEP-92 15-SEP-921215634CREDITY
107 211 07-SEP-9221-SEP-9215142171CREDITY
108 212 07-SEP-9210-SEP-9213149570CREDITY
109 213 08-SEP-92 28-SEP-92111020935CREDITY
110 214 09-SEP-92 21-SEP-92111539.13CASHY
111 204 09-SEP-92 21-SEP-92112770CASHY
97 201 28-AUG-92 17-SEP-921284000CREDITY
98 202 31-AUG-92 10-SEP-9214595CASHY
99 203 31-AUG-92 18-SEP-92147707CREDITY
112 210 31-AUG-92 10-SEP-9212550CREDITY
16 rows selected.
.....................................................................................................................................................
B-16 Oracle Developer: Build Forms II
S_PRODUCT Description
.....................................................................................................................................................
S_PRODUCT Description
Column NameNull?Datatype
---------------------------------------------------
ID NOT NULLNUMBER(7)
NAMENOT NULLVARCHAR2(50)
SHORT_DESCVARCHAR2(255)
LONGTEXT_IDNUMBER(7)
IMAGE_ID NUMBER(7)
SUGGESTED_WHLSL_PRICE‘NUMBER(11,2)
WHLSL_UNITSVARCHAR2(25)
.....................................................................................................................................................
Oracle Developer: Build Forms II B-17
Appendix B: Table Descriptions and Data
.....................................................................................................................................................
S_PRODUCT Data
ID NAMESHORT_DESCLONGTEXT_ID
-----------------------------------------
IMAGE_IDSUGGESTED_WHLSL_PRICEWHLSL_UNITS
----------------------------------------
10011BootBeginner’s ski boot518
1001150
.....................................................................................................................................................
B-18 Oracle Developer: Build Forms II
S_PRODUCT Data
.....................................................................................................................................................
ID NAMESHORT_DESCLONGTEXT_ID
-------------------------------------------
IMAGE_IDSUGGESTED_WHLSL_PRICEWHLSL_UNITS
----------------------------------------
20510Black Hawk Knee pads, pair1017
Knee Pads9
.....................................................................................................................................................
Oracle Developer: Build Forms II B-19
Appendix B: Table Descriptions and Data
.....................................................................................................................................................
ID NAMESHORT_DESCLONGTEXT_ID
-------------------------------------------
IMAGE_IDSUGGESTED_WHLSL_PRICEWHLSL_UNITS
----------------------------------------
40421Alexeyer ProStraight bar928
Lifting Bar
138165
.....................................................................................................................................................
B-20 Oracle Developer: Build Forms II
S_PRODUCT Data
.....................................................................................................................................................
ID NAMESHORT_DESCLONGTEXT_ID
---------------------------------------------
IMAGE_IDSUGGESTED_WHLSL_PRICEWHLSL_UNITS
----------------------------------------
50273Chapman HelmetBatting helmet780
122322.89
33 rows selected.
.....................................................................................................................................................
Oracle Developer: Build Forms II B-21
Appendix B: Table Descriptions and Data
.....................................................................................................................................................
IDNAME
--- --------------------------
1North America
2South America
3Africa / Middle East
4Asia
5Europe
.....................................................................................................................................................
B-22 Oracle Developer: Build Forms II
S_TITLE Description and Data
.....................................................................................................................................................
TITLE
------------------------
President
Sales Representative
Stock Clerk
VP, Administration
VP, Finance
VP, Operations
VP, Sales
Warehouse Manager
8 rows selected.
.....................................................................................................................................................
Oracle Developer: Build Forms II B-23
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)
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)
dept_type
-------------------------------------------------
ID NUMBER
NAME VARCHAR2(25)
REGION_ID NUMBER(7)
.....................................................................................................................................................
B-24 Oracle Developer: Build Forms II
Oracle8 objects: types, tables
.....................................................................................................................................................
tables
oo_emp_Table_ObjCol
Name Null? Type
-------------------------------------------------
ID NUMBER(7)
LAST_NAME VARCHAR2(25)
FIRST_NAMEVARCHAR2(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_NAMEFIRST_NAME USERID
--------- --------------------- --------------- --------
START_DAT MANAGER_ID TITLE
--------- ---------- -------------------------
DEPT_ID(ID, NAME, REGION_ID)
-----------------------------------------------------------
SALARY COMMISSION_PCT
---------- --------------
1VelasquezCarmencvelasqu
03-MAR-90President
DEPT_TYPE(50, ’Administration’, 1)
2500
2NgaoLaDorislngao
08-MAR-901 VP Operations
DEPT_TYPE(41, ’Operations’, 1)
1450
3NagayamaMidorimnagayam
17-JUN-91 1 VP Sales
DEPT_TYPE(31, ’Sales’, 1)
1400
.....................................................................................................................................................
Oracle Developer: Build Forms II B-25
Appendix B: Table Descriptions and Data
.....................................................................................................................................................
ID LAST_NAMEFIRST_NAMEUSERID
---------- --------------------------------- --------
START_DAT MANAGER_ID TITLE
--------- ---------- -------------------------
DEPT_ID(ID, NAME, REGION_ID)
------------------------------------------------------------
SALARY COMMISSION_PCT
---------- --------------
4 Quick-To-See Markmquickto
07-APR-901 VP Finance
DEPT_TYPE(10, ’Finance’, 1)
1450
5RopeburnAudryaropebur
04-MAR-901 VP Administration
DEPT_TYPE(50, ’Administration’, 1)
1550
6 Urguhart Mollymurguhar
18-JAN-91 2 Warehouse Manager
DEPT_TYPE(41, ’Operations’, 1)
1200
7 MenchuRobertarmenchu
14-MAY-90 2 Warehouse Manager
DEPT_TYPE(42, ’Operations’, 2)
1250
8 Biri Benbbiri
07-APR-902 Warehouse Manager
DEPT_TYPE(43, ’Operations’, 3)
1100
9 CatchpoleAntoinetteacatchpo
09-FEB-922 Warehouse Manager
DEPT_TYPE(44, ’Operations’, 4)
1300
.....................................................................................................................................................
B-26 Oracle Developer: Build Forms II
Oracle8 objects: types, tables
.....................................................................................................................................................
ID LAST_NAMEFIRST_NAMEUSERID
---------- --------------------------------- --------
START_DAT MANAGER_ID TITLE
--------- ---------- -------------------------
DEPT_ID(ID, NAME, REGION_ID)
------------------------------------------------------------
SALARY COMMISSION_PCT
---------- --------------
10 HavelMartamhavel
27-FEB-912 Warehouse Manager
DEPT_TYPE(45, ’Operations’, 5)
1307
11 MageeColincmagee
14-MAY-903 Sales Representative
DEPT_TYPE(31, ’Sales’, 1)
140010
12 GiljumHenryhgiljum
18-JAN-92 3 Sales Representative
DEPT_TYPE(32, ’Sales’, 2)
149013
13 SedeghiYasminysedeghi
18-FEB-913 Sales Representative
DEPT_TYPE(33, ’Sales’, 3)
1515 10
14 NguyenMaimnguyen
22-JAN-923 Sales Representative
DEPT_TYPE(34, ’Sales’, 4)
1525 15
15 DumasAndreadumas
09-OCT-913 Sales Representative
DEPT_TYPE(35, ’Sales’, 5)
145018
.....................................................................................................................................................
Oracle Developer: Build Forms II B-27
Appendix B: Table Descriptions and Data
.....................................................................................................................................................
ID LAST_NAMEFIRST_NAMEUSERID
---------- --------------------------------- --------
START_DAT MANAGER_ID TITLE
--------- ---------- -------------------------
DEPT_ID(ID, NAME, REGION_ID)
------------------------------------------------------------
SALARY COMMISSION_PCT
---------- --------------
16 MaduroElenaemaduro
07-FEB-926 Stock Clerk
DEPT_TYPE(41, ’Operations’, 1)
1400
17SmithGeorgegsmith
08-MAR-906 Stock Clerk
DEPT_TYPE(41, ’Operations’, 1)
940
18 NozakiAkiraanozaki
09-FEB-91 7 Stock Clerk
DEPT_TYPE(42, ’Operations’, 2)
1200
19PatelVikramvpatel
06-AUG-91 7 Stock Clerk
DEPT_TYPE(42, ’Operations’, 2)
795
20 NewmanChadcnewman
21-JUL-918 Stock Clerk
DEPT_TYPE(43, ’Operations’, 3)
750
21 MarkarianAlexanderamarkari
26-MAY-91 8 Stock Clerk
DEPT_TYPE(43, ’Operations’, 3)
850
.....................................................................................................................................................
B-28 Oracle Developer: Build Forms II
Oracle8 objects: types, tables
.....................................................................................................................................................
ID LAST_NAMEFIRST_NAMEUSERID
---------- --------------------------------- --------
START_DAT MANAGER_ID TITLE
--------- ---------- -------------------------
DEPT_ID(ID, NAME, REGION_ID)
------------------------------------------------------------
SALARY COMMISSION_PCT
---------- --------------
22 ChangEddieechang
30-NOV-90 9 Stock Clerk
DEPT_TYPE(44, ’Operations’, 4)
800
23 PatelRadharpatel
17-OCT-909 Stock Clerk
DEPT_TYPE(34, ’Sales’, 4)
795
24 Dancs Belabdancs
17-MAR-9110 Stock Clerk
DEPT_TYPE(45, ’Operations’, 5)
860
25 SchwartzSylviesschwart
09-MAY-9110 Stock Clerk
DEPT_TYPE(45, ’Operations’, 5)
1100
oo_emp_Table_RefCol
Name Null? Type
-------------------------------------------------
ID NUMBER(7)
LAST_NAMEVARCHAR2(25)
FIRST_NAMEVARCHAR2(25)
USERIDVARCHAR2(8)
START_DATEDATE
MANAGER_IDNUMBER(7)
TITLE VARCHAR2(25)
DEPT_IDREF OF DEPT_TYPE
SALARYNUMBER(11,2)
COMMISSION_PCTNUMBER(4,2)
.....................................................................................................................................................
Oracle Developer: Build Forms II B-29
Appendix B: Table Descriptions and Data
.....................................................................................................................................................
ID LAST_NAMEFIRST_NAMEUSERID
---------- --------------------------------- --------
START_DAT MANAGER_ID TITLE
--------- ---------- -------------------------
DEPT_ID(ID, NAME, REGION_ID)
------------------------------------------------------------
SALARY COMMISSION_PCT
---------- --------------
1 Velasquez Carmencvelasqu
03-MAR-90President
0000220208447F54A9ED64676AE03408002072C15B447F54A9ED55676AE0340800
2072C15B
2500
2NgaoLaDorislngao
08-MAR-90 1 VP Operations
0000220208447F54A9ED5F676AE03408002072C15B447F54A9ED55676AE0340800
2072C15B
1450
3 NagayamaMidorimnagayam
17-JUN-91 1 VP Sales
0000220208447F54A9ED5A676AE03408002072C15B447F54A9ED55676AE0340800
2072C15B
1400
4 Quick-To-SeeMarkmquickto
07-APR-90 1 VP Finance
0000220208447F54A9ED59676AE03408002072C15B447F54A9ED55676AE0340800
2072C15B
1450
5 Ropeburn Audryaropebur
04-MAR-90 1 VP Administration
0000220208447F54A9ED64676AE03408002072C15B447F54A9ED55676AE0340800
2072C15B
1550
.....................................................................................................................................................
B-30 Oracle Developer: Build Forms II
Oracle8 objects: types, tables
.....................................................................................................................................................
ID LAST_NAMEFIRST_NAMEUSERID
---------- --------------------------------- --------
START_DAT MANAGER_ID TITLE
--------- ---------- -------------------------
DEPT_ID(ID, NAME, REGION_ID)
------------------------------------------------------------
SALARY COMMISSION_PCT
---------- --------------
6 UrguhartMollymurguhar
18-JAN-912 Warehouse Manager
0000220208447F54A9ED5F676AE03408002072C15B447F54A9ED55676AE0340800
2072C15B
1200
9 CatchpoleAntoinetteacatchpo
09-FEB-922 Warehouse Manager
0000220208447F54A9ED62676AE03408002072C15B447F54A9ED55676AE0340800
2072C15B
1300
10 Havel Martamhavel
27-FEB-91 2 Warehouse Manager
0000220208447F54A9ED63676AE03408002072C15B447F54A9ED55676AE0340800
2072C15B
1307
11 Magee Colincmagee
14-MAY-90 3 Sales Representative
0000220208447F54A9ED5A676AE03408002072C15B447F54A9ED55676AE0340800
2072C15B
1400 10
13 SedeghiYasminysedeghi
18-FEB-91 3 Sales Representative
0000220208447F54A9ED5C676AE03408002072C15B447F54A9ED55676AE0340800
2072C15B
1515 10
.....................................................................................................................................................
Oracle Developer: Build Forms II B-31
Appendix B: Table Descriptions and Data
.....................................................................................................................................................
ID LAST_NAMEFIRST_NAMEUSERID
---------- --------------------------------- --------
START_DAT MANAGER_ID TITLE
--------- ---------- -------------------------
DEPT_ID(ID, NAME, REGION_ID)
------------------------------------------------------------
SALARY COMMISSION_PCT
---------- --------------
14 NguyenMaimnguyen
22-JAN-92 3 Sales Representative
0000220208447F54A9ED5D676AE03408002072C15B447F54A9ED55676AE0340800
2072C15B
1525 15
15 DumasAndreadumas
09-OCT-913 Sales Representative
0000220208447F54A9ED5E676AE03408002072C15B447F54A9ED55676AE0340800
2072C15B
1450 18
16 MaduroElenaemaduro
07-FEB-92 6 Stock Clerk
0000220208447F54A9ED5F676AE03408002072C15B447F54A9ED55676AE0340800
2072C15B
1400
17 SmithGeorgegsmith
08-MAR-90 6 Stock Clerk
0000220208447F54A9ED5F676AE03408002072C15B447F54A9ED55676AE0340800
2072C15B
940
18 NozakiAkiraanozaki
09-FEB-91 7 Stock Clerk
0000220208447F54A9ED60676AE03408002072C15B447F54A9ED55676AE0340800
2072C15B
1200
.....................................................................................................................................................
B-32 Oracle Developer: Build Forms II
Oracle8 objects: types, tables
.....................................................................................................................................................
ID LAST_NAMEFIRST_NAMEUSERID
---------- --------------------------------- --------
START_DAT MANAGER_ID TITLE
--------- ---------- -------------------------
DEPT_ID(ID, NAME, REGION_ID)
------------------------------------------------------------
SALARY COMMISSION_PCT
---------- --------------
19 PatelVikramvpatel
06-AUG-91 7 Stock Clerk
0000220208447F54A9ED60676AE03408002072C15B447F54A9ED55676AE0340800
2072C15B
795
20 NewmanChadcnewman
21-JUL-918 Stock Clerk
0000220208447F54A9ED61676AE03408002072C15B447F54A9ED55676AE0340800
2072C15B
750
21 MarkarianAlexanderamarkari
26-MAY-91 8 Stock Clerk
0000220208447F54A9ED61676AE03408002072C15B447F54A9ED55676AE0340800
2072C15B
850
22 ChangEddieechang
30-NOV-90 9 Stock Clerk
0000220208447F54A9ED62676AE03408002072C15B447F54A9ED55676AE0340800
2072C15B
800
23 PatelRadharpatel
17-OCT-90 9 Stock Clerk
0000220208447F54A9ED5D676AE03408002072C15B447F54A9ED55676AE0340800
2072C15B
795
.....................................................................................................................................................
Oracle Developer: Build Forms II B-33
Appendix B: Table Descriptions and Data
.....................................................................................................................................................
ID LAST_NAMEFIRST_NAMEUSERID
---------- --------------------------------- --------
START_DAT MANAGER_ID TITLE
--------- ---------- -------------------------
DEPT_ID(ID, NAME, REGION_ID)
------------------------------------------------------------
SALARY COMMISSION_PCT
---------- --------------
24 DancsBelabdancs
17-MAR-91 10 Stock Clerk
0000220208447F54A9ED63676AE03408002072C15B447F54A9ED55676AE0340800
2072C15B
860
25 SchwartzSylviesschwart
09-MAY-91 10 Stock Clerk
0000220208447F54A9ED63676AE03408002072C15B447F54A9ED55676AE0340800
2072C15B
1100
oo_dept_table
Name Null? Type
-------------------------------------------------
ID NUMBER
NAME VARCHAR2(25)
REGION_IDNUMBER(7)
ID NAME REGION_ID
-------------------------------------------------
10 Finance1
31 Sales 1
32 Sales 2
33 Sales 3
34 Sales 4
35 Sales 5
41 Operations 1
42 Operations 2
43 Operations 3
44 Operations 4
45 Operations 5
50 Administration 1
.....................................................................................................................................................
B-34 Oracle Developer: Build Forms II
Oracle8 objects: types, tables
.....................................................................................................................................................
rel_emp_Table_Objcol
Name Null? Type
-------------------------------------------------
ID NUMBER(7)
LAST_NAMEVARCHAR2(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_NAMEFIRST_NAMEUSERID
---------- --------------------------------- --------
START_DAT MANAGER_ID TITLE
--------- ---------- -------------------------
DEPT_ID(ID, NAME, REGION_ID)
------------------------------------------------------------
SALARY COMMISSION_PCT
---------- --------------
1 VelasquezCarmencvelasqu
03-MAR-90President
DEPT_TYPE(50, ’Administration’, 1)
2500
2 NgaoLaDorislngao
08-MAR-90 1 VP Operations
DEPT_TYPE(41, ’Operations’, 1)
1450
3 NagayamaMidorimnagayam
17-JUN-91 1 VP Sales
DEPT_TYPE(31, ’Sales’, 1)
1400
.....................................................................................................................................................
Oracle Developer: Build Forms II B-35
Appendix B: Table Descriptions and Data
.....................................................................................................................................................
ID LAST_NAMEFIRST_NAMEUSERID
---------- --------------------------------- --------
START_DAT MANAGER_ID TITLE
--------- ---------- -------------------------
DEPT_ID(ID, NAME, REGION_ID)
------------------------------------------------------------
SALARY COMMISSION_PCT
---------- --------------
4 Quick-To-SeeMarkmquickto
07-APR-90 1 VP Finance
DEPT_TYPE(10, ’Finance’, 1)
1450
5 RopeburnAudryaropebur
04-MAR-90 1 VP Administration
DEPT_TYPE(50, ’Administration’, 1)
1550
6 Urguhart Mollymurguhar
18-JAN-91 2 Warehouse Manager
DEPT_TYPE(41, ’Operations’, 1)
1200
7 Menchu Robertarmenchu
14-MAY-90 2 Warehouse Manager
DEPT_TYPE(42, ’Operations’, 2)
1250
8 Biri Benbbiri
07-APR-90 2 Warehouse Manager
DEPT_TYPE(43, ’Operations’, 3)
1100
9 CatchpoleAntoinetteacatchpo
09-FEB-92 2 Warehouse Manager
DEPT_TYPE(44, ’Operations’, 4)
1300
.....................................................................................................................................................
B-36 Oracle Developer: Build Forms II
Oracle8 objects: types, tables
.....................................................................................................................................................
ID LAST_NAMEFIRST_NAMEUSERID
---------- --------------------------------- --------
START_DAT MANAGER_ID TITLE
--------- ---------- -------------------------
DEPT_ID(ID, NAME, REGION_ID)
------------------------------------------------------------
SALARY COMMISSION_PCT
---------- --------------
10 HavelMartamhavel
27-FEB-91 2 Warehouse Manager
DEPT_TYPE(45, ’Operations’, 5)
1307
11 MageeColincmagee
14-MAY-90 3 Sales Representative
DEPT_TYPE(31, ’Sales’, 1)
1400 10
12 GiljumHenryhgiljum
18-JAN-92 3 Sales Representative
DEPT_TYPE(32, ’Sales’, 2)
1490 13
14 NguyenMaimnguyen
22-JAN-92 3 Sales Representative
DEPT_TYPE(34, ’Sales’, 4)
1525 15
.....................................................................................................................................................
Oracle Developer: Build Forms II B-37
Appendix B: Table Descriptions and Data
.....................................................................................................................................................
ID LAST_NAMEFIRST_NAMEUSERID
---------- --------------------------------- --------
START_DAT MANAGER_ID TITLE
--------- ---------- -------------------------
DEPT_ID(ID, NAME, REGION_ID)
------------------------------------------------------------
SALARY COMMISSION_PCT
---------- --------------
16 MaduroElenaemaduro
07-FEB-92 6 Stock Clerk
DEPT_TYPE(41, ’Operations’, 1)
1400
19 PatelVikramvpatel
06-AUG-91 7 Stock Clerk
DEPT_TYPE(42, ’Operations’, 2)
795
21 Markarian Alexanderamarkari
26-MAY-91 8 Stock Clerk
DEPT_TYPE(43, ’Operations’, 3)
850
.....................................................................................................................................................
B-38 Oracle Developer: Build Forms II
Oracle8 objects: types, tables
.....................................................................................................................................................
ID LAST_NAMEFIRST_NAMEUSERID
---------- --------------------------------- --------
START_DAT MANAGER_ID TITLE
--------- ---------- -------------------------
DEPT_ID(ID, NAME, REGION_ID)
------------------------------------------------------------
SALARY COMMISSION_PCT
---------- --------------
22 ChangEddieechang
30-NOV-90 9 Stock Clerk
DEPT_TYPE(44, ’Operations’, 4)
800
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)
.....................................................................................................................................................
Oracle Developer: Build Forms II B-39
Appendix B: Table Descriptions and Data
.....................................................................................................................................................
ID LAST_NAMEFIRST_NAMEUSERID
---------- --------------------------------- --------
START_DAT MANAGER_ID TITLE
--------- ---------- -------------------------
DEPT_ID(ID, NAME, REGION_ID)
------------------------------------------------------------
SALARY COMMISSION_PCT
---------- --------------
1 Velasquez Carmen cvelasqu
03-MAR-90 President
0000220208447F54A9ED64676AE03408002072C15B447F54A9ED55676AE0340800
2072C15B
2500
.....................................................................................................................................................
B-40 Oracle Developer: Build Forms II
Oracle8 objects: types, tables
.....................................................................................................................................................
ID LAST_NAMEFIRST_NAMEUSERID
---------- --------------------------------- --------
START_DAT MANAGER_ID TITLE
--------- ---------- -------------------------
DEPT_ID(ID, NAME, REGION_ID)
------------------------------------------------------------
SALARY COMMISSION_PCT
---------- --------------
6 Urguhart Molly murguhar
18-JAN-91 2 Warehouse Manager
0000220208447F54A9ED5F676AE03408002072C15B447F54A9ED55676AE0340800
2072C15B
1200
.....................................................................................................................................................
Oracle Developer: Build Forms II B-41
Appendix B: Table Descriptions and Data
.....................................................................................................................................................
ID LAST_NAMEFIRST_NAMEUSERID
---------- --------------------------------- --------
START_DAT MANAGER_ID TITLE
--------- ---------- -------------------------
DEPT_ID(ID, NAME, REGION_ID)
------------------------------------------------------------
SALARY COMMISSION_PCT
---------- --------------
14 Nguyen Mai mnguyen
22-JAN-92 3 Sales Representative
0000220208447F54A9ED5D676AE03408002072C15B447F54A9ED55676AE0340800
2072C15B
1525 15
.....................................................................................................................................................
B-42 Oracle Developer: Build Forms II
Oracle8 objects: types, tables
.....................................................................................................................................................
ID LAST_NAMEFIRST_NAMEUSERID
---------- --------------------------------- --------
START_DAT MANAGER_ID TITLE
--------- ---------- -------------------------
DEPT_ID(ID, NAME, REGION_ID)
------------------------------------------------------------
SALARY COMMISSION_PCT
---------- --------------
19 Patel Vikram vpatel
06-AUG-91 7 Stock Clerk
0000220208447F54A9ED60676AE03408002072C15B447F54A9ED55676AE0340800
2072C15B
795
.....................................................................................................................................................
Oracle Developer: Build Forms II B-43
Appendix B: Table Descriptions and Data
.....................................................................................................................................................
ID LAST_NAMEFIRST_NAMEUSERID
---------- --------------------------------- --------
START_DAT MANAGER_ID TITLE
--------- ---------- -------------------------
DEPT_ID(ID, NAME, REGION_ID)
------------------------------------------------------------
SALARY COMMISSION_PCT
---------- --------------
24 Dancs Bela bdancs
17-MAR-91 10 Stock Clerk
0000220208447F54A9ED63676AE03408002072C15B447F54A9ED55676AE0340800
2072C15B
860
.....................................................................................................................................................
B-44 Oracle Developer: Build Forms II
C
................................
Project Builder
Addendum
Appendix C: Project Builder Addendum
.....................................................................................................................................................
Objectives
After completing this addendum, you
should be able to do the following:
• Implement team development with
Project Builder
– Provide a Global Registry of common
types
– Import and export projects
– Print and distribute project reports
Objectives
• Customize Project Builder
– Create module types
– Create actions
– Create macros
– Customize the launcher
• Describe inheritance in Project Builder
.....................................................................................................................................................
C-2 Oracle Developer: Build Forms II
Introduction
.....................................................................................................................................................
Introduction
Overview
You have already seen how to use Project Builder. This appendix explains how to use
Oracle Developer Project Builder in a team environment, so that many developers can
be working together on the many files that make up a project. The appendix also
explains how to customize Oracle Developer Project Builder to the specific
requirements of your team, and how inheritance can be used to simplify
customization.
Objectives
After completing this appendix, you should be able to do the following:
• Team development with Project Builder.
– Provide a Global Registry of common types.
– Import/Export projects.
– Print and distribute project reports.
• Customize the Project Builder environment.
– Create module types
– Create actopms
– Create macros
– Add tools to the toolbar
• Describe inheritance in Project Builder.
.....................................................................................................................................................
Oracle Developer: Build Forms II C-3
Appendix C: Project Builder Addendum
.....................................................................................................................................................
Team Project
members administrator
Technical Note
In some cases, the project administrator may decide to share a project and allow more
than one user to update it. If a developer attempts to change a project, adding an entry
for example, Project Builder first checks whether the project has changed since it was
last read; if it has changed, Project Builder notifies the developer that the changes
cannot be saved, and rereads the latest version of the project. The developer can then
attempt to make the changes again. Project Builder never overwrites one developer’s
changes with another’s, thus avoiding “last write wins” problems.
.....................................................................................................................................................
C-4 Oracle Developer: Build Forms II
Team Development with Project Builder
.....................................................................................................................................................
.....................................................................................................................................................
Oracle Developer: Build Forms II C-5
Appendix C: Project Builder Addendum
.....................................................................................................................................................
.....................................................................................................................................................
C-6 Oracle Developer: Build Forms II
Team Development with Project Builder
.....................................................................................................................................................
.....................................................................................................................................................
Oracle Developer: Build Forms II C-7
Appendix C: Project Builder Addendum
.....................................................................................................................................................
.....................................................................................................................................................
C-8 Oracle Developer: Build Forms II
Team Development with Project Builder
.....................................................................................................................................................
.....................................................................................................................................................
Oracle Developer: Build Forms II C-9
Appendix C: Project Builder Addendum
.....................................................................................................................................................
.....................................................................................................................................................
C-10 Oracle Developer: Build Forms II
Generating and Printing Project Reports
.....................................................................................................................................................
.....................................................................................................................................................
Oracle Developer: Build Forms II C-11
Appendix C: Project Builder Addendum
.....................................................................................................................................................
Instructor Note
Demonstration:
1 Expand the User Registry.
2 Delete the ICO File type.
3 Select File––>New––>Type.
4 Explain the wizard and the properties.
5 Click the “Choose file for model ...” button.
6 From the lab directory, select the abort.ico file.
7 Choose an appropriate icon to represent the new ICO File type.
.....................................................................................................................................................
C-12 Oracle Developer: Build Forms II
Defining New Module Types
.....................................................................................................................................................
.....................................................................................................................................................
Oracle Developer: Build Forms II C-13
Appendix C: Project Builder Addendum
.....................................................................................................................................................
Instructor Note
Demonstration:
1 Expand the User Registry.
2 Delete the ICO File type.
3 Select File––>New––>Type.
4 Explain the wizard and the properties.
5 Click the “Choose file for model ...” button.
6 From the lab directory, select the abort.ico file.
7 Choose an appropriate icon to represent the new ICO File type.
.....................................................................................................................................................
C-14 Oracle Developer: Build Forms II
Identifying New Module Types
.....................................................................................................................................................
.....................................................................................................................................................
Oracle Developer: Build Forms II C-15
Appendix C: Project Builder Addendum
.....................................................................................................................................................
.....................................................................................................................................................
C-16 Oracle Developer: Build Forms II
Describing New Module Types
.....................................................................................................................................................
.....................................................................................................................................................
Oracle Developer: Build Forms II C-17
Appendix C: Project Builder Addendum
.....................................................................................................................................................
.....................................................................................................................................................
C-18 Oracle Developer: Build Forms II
Actions for New Module Types
.....................................................................................................................................................
.....................................................................................................................................................
Oracle Developer: Build Forms II C-19
Appendix C: Project Builder Addendum
.....................................................................................................................................................
.....................................................................................................................................................
C-20 Oracle Developer: Build Forms II
An Icon for New Module Types
.....................................................................................................................................................
.....................................................................................................................................................
Oracle Developer: Build Forms II C-21
Appendix C: Project Builder Addendum
.....................................................................................................................................................
• Actions can be
defined for a type,
project, or
components through
the Property Palette.
• Action definitions
often use macros.
Technical Note
If you add an action to a type in the user registry, all objects of that type that reference
the user registry inherit the new action. If you add an action to an object, the action
applies only to that object, unless that object is a project or subproject. Then the action
applies to the child objects of the project if the action affects the type of the child
objects.
Instructor Note
Demonstration:
1 Expand the User Registry.
2 Select the SQL File type, and edit the properties.
3 Select the Run Script action and edit this action.
4 Explain the properties.
You can also delete this action and re-create it.
.....................................................................................................................................................
C-22 Oracle Developer: Build Forms II
Modifying Types Using Actions
.....................................................................................................................................................
.....................................................................................................................................................
Oracle Developer: Build Forms II C-23
Appendix C: Project Builder Addendum
.....................................................................................................................................................
Customizing Actions
by Using Macros
.....................................................................................................................................................
C-24 Oracle Developer: Build Forms II
Customizing Actions by Using Macros
.....................................................................................................................................................
Simple Macros
Simple macros are macros that equate to simple strings. When you reference such a
macro from an action or another macro, the macro will be replaced by that string. If
you want to reference a simple macro, insert the macro name, enclosed by braces,
within the action or macro at the point in the command where such a string would be
executed.
Built-in Macros
Built-in macros are macros provided by Project Builder for use with actions. These
macros have one character name and you cannot redefine the value.
Note: For a complete list of the built-in macros, see the Project Builder online Help.
Predefined Macros
These macros are customizable macros that are provided by Project Builder and
assigned preliminary values.
The values assigned to predefined macros are preliminary and easily customized to
suit your preferences. Possible values depend on the tools available on your platform.
Example
For Windows platforms, the macro D2KEDITOR is defined as
{EDITOR ? {EDITOR} : notepad}, which means that your default editor will be
Notepad unless you define a macro named EDITOR and equate it to another word-
processing program available in Windows.
In Motif, D2KEDITOR is defined as {EDITOR ? {EDITOR} : vi}, which means that
your default editor will be vi unless you define a macro named EDITOR and equate it
to another word-processing program available in Motif.
.....................................................................................................................................................
Oracle Developer: Build Forms II C-25
Appendix C: Project Builder Addendum
.....................................................................................................................................................
Macros can:
• Be defined for each
object through the
Property Palette
• Be conditional
• Reference other macros
.....................................................................................................................................................
C-26 Oracle Developer: Build Forms II
Customizing Actions by Using Macros
.....................................................................................................................................................
Conditionalizing Macros
You can set the value of a macro depending on a condition. To do so, use the following
expression:
{macroname?expression1:expression2}
{EDITOR ? {EDITOR} : vi}
Label Description
macroname The name of the macro
expression1 The expression to which the macro is evaluated if the macro has been
defined and has an assigned value
expression2 The expression to which the macro is evaluated if the macro either has not
(Optional) been previously defined or has been defined but has no assigned value
Nesting Macros
You can nest a macro within another macro by inserting its name, enclosed by braces,
in the string to which the outer macro is equated.
The innermost macros is expanded first, followed by the next level, and then the next,
until the action containing the nested macros is evaluated and executed.
In addition, macros are recursively expanded. For example, if the value of a macro
named bar is set to the already-defined macro {foo}, when bar is referenced from
within an action or another macro, the value substituted for bar is the value of foo.
.....................................................................................................................................................
Oracle Developer: Build Forms II C-27
Appendix C: Project Builder Addendum
.....................................................................................................................................................
.....................................................................................................................................................
C-28 Oracle Developer: Build Forms II
Customizing the Launcher
.....................................................................................................................................................
.....................................................................................................................................................
Oracle Developer: Build Forms II C-29
Appendix C: Project Builder Addendum
.....................................................................................................................................................
Technical Note
In Windows 95, Windows 98 and Windows NT, actions defined in the registry for a
particular file type, such as Open, Edit, and Print, are automatically available in
Project Builder using a special notation. For example, [open {name}] means do
whatever Windows 95 defines as the Open action for this filename.
.....................................................................................................................................................
C-30 Oracle Developer: Build Forms II
Inheritance in Project Builder
.....................................................................................................................................................
Generic Types
Each type description applies to a single file type, with the exception of three
predefined types that provide generic definitions for text files (Text File type), the files
in which project information is stored
(Project type), and links to files within projects (Project Link type).
To view these type definitions, go to the Global Registry in the Project Navigator,
select one of the types, and select either Edit Type or Property Palette from the pop-up
menu.
Two generic types allow a property (such as Version Control File) or an action (such as
Edit) to be easily set across types without your having to define it individually for each
type.
Type Description
<Any File> Properties, actions, and macros are inherited by every type and
therefore every entry.
<Text File> Properties, actions, and macros are inherited by every type whose File
Contents property is set to Text rather than Binary.
.....................................................................................................................................................
Oracle Developer: Build Forms II C-31
Appendix C: Project Builder Addendum
.....................................................................................................................................................
Actions
The three types of actions are:
• Predefined: Shipped with Project Builder
• User-defined: Custom actions, defined by
the developer
• Global:
– Included with Project Builder
– Implemented across projects and files
Technical Note
The command strings for predefined actions are platform-dependent and either are
based on tools commonly available on the platforms, or take advantage of commands
already registered by the operating system for the different types.
If your platform already recognizes commands associated with file types, you can take
advantage of these in your actions.
For example, if you want to create a Play action for video files on Windows and the
Windows Explorer has already associated a command with video files, you can use the
Windows command by enclosing it in brackets in your action definition; for example,
[play {n}], where {n} is the built-in macro that evaluates to the name of the item you
selected in the Project Navigator.
.....................................................................................................................................................
C-32 Oracle Developer: Build Forms II
Actions
.....................................................................................................................................................
Actions
Project Builder has three types of actions:
• Predefined actions
• User-defined actions
• Global actions
Predefined Actions
Predefined actions are shipped with Project Builder and are automatically available
through menu items or the toolbar.
Predefined actions vary from file type to file type. To determine which
predefined actions are available for a specific type:
1 Select that type in the Project Navigator.
2 Display the Property Palette.
3 View the entries under the Actions node.
Note: Predefined actions are completely customizable. Customization of predefined
actions is covered in detail in Appendix C, “Project Builder Addendum.”
User-Defined Actions
User-defined actions are custom actions and you define them explicitly. User defined
actions are covered in detail in Appendix C, “Project Builder Addendum.”
Global Actions
Global actions are included with Project Builder and work across projects and files,
adapting themselves to varied file types. The global actions are a subset of the
predefined actions and include the following:
• Build actions (Build Selection, Build Incremental, Build All)
• Packaging action (Deliver)
• Source control (Check In, Check Out, Get RCS Information, Lock File in RCS)
.....................................................................................................................................................
Oracle Developer: Build Forms II C-33
Appendix C: Project Builder Addendum
.....................................................................................................................................................
Summary
This addendum covers the following
topics:
• Team development with Project Builder
• Customize Project Builder
• Inheritance in Project Builder
.....................................................................................................................................................
C-34 Oracle Developer: Build Forms II
Summary
.....................................................................................................................................................
Summary
Team Development with Project Builder
• Provide a Global Registry of common types
• Import and export projects
• Print and distribute project reports
.....................................................................................................................................................
Oracle Developer: Build Forms II C-35
Appendix C: Project Builder Addendum
.....................................................................................................................................................
.....................................................................................................................................................
C-36 Oracle Developer: Build Forms II
D
................................
Introduction to
Oracle8 Object Features
Appendix D: Introduction to Oracle8 Object Features
......................................................................................................................................................
Objectives
After completing this appendix, you should
be able to:
• Describe the new Oracle8 scalar data
types
• 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 Object
Navigator
Copyright Oracle Corporation, 1999. All rights reserved.
......................................................................................................................................................
D-2 Oracle Developer: Build Forms II
Introduction
......................................................................................................................................................
Introduction
In this appendix you will review certain object features of Oracle8. This appendix also
explains how these objects are displayed in the Object Navigator.
......................................................................................................................................................
Oracle Developer: Build Forms II D-3
Appendix D: Introduction to Oracle8 Object Features
......................................................................................................................................................
• NCHAR
• NVARCHAR2
• FLOAT
• NLS types
......................................................................................................................................................
D-4 Oracle Developer: Build Forms II
New Oracle8 Data Types
......................................................................................................................................................
NLS Types
Oracle8 offers extended National Language Support (NLS) including national
character sets and the data types NCHAR and NVARCHAR2, which store NLS data.
With NLS, number and date formats adapt automatically to the language conventions
specified for a user session. Thus, users around the world can interact with the Oracle
server in their native languages. NLS is discussed in Oracle8 Server Reference
Manual.
......................................................................................................................................................
Oracle Developer: Build Forms II D-5
Appendix D: Introduction to Oracle8 Object Features
......................................................................................................................................................
Object Types
Attributes
ORDER
po_no
custinfo
line_items
amount
Methods
Copyright Oracle Corporation, 1999. All rights reserved.
......................................................................................................................................................
D-6 Oracle Developer: Build Forms II
Object Types
......................................................................................................................................................
Object Types
An object type is a user-defined composite data type. You build object types from
predefined data types or from previously defined object types. When you create an
object type you specify the component types from which it is built. You also specify
the functions and procedures that can act on the object type. Thus, an object type is in
some ways similar to a record type, and in some ways similar to a package.
An object type must have one or more attributes and can contain methods.
......................................................................................................................................................
Oracle Developer: Build Forms II D-7
Appendix D: Introduction to Oracle8 Object Features
......................................................................................................................................................
Object Types
Ship
ORDER
Cancel
Check
status
Hold
......................................................................................................................................................
D-8 Oracle Developer: Build Forms II
Object Types
......................................................................................................................................................
Methods An object type is also similar to a package. Once an object is declared, its
attributes are similar to package variables. And 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.
Like package variables, attributes declared in the object type specification are public
and those declared in the body are private. And 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;
END;
MEMBER FUNCTION get_dept_id
RETURN NUMBER
IS
BEGIN
RETURN (dept_id);
END;
END;
......................................................................................................................................................
Oracle Developer: Build Forms II D-9
Appendix D: Introduction to Oracle8 Object Features
......................................................................................................................................................
Object Tables
Instructor Note
At this point, review the fact that object types are not themselves objects. They are
only blueprints for objects.
The term object can be confusing because Oracle uses the term to refer to constructs
within the database; for example, tables, views, procedures, and so on. These objects
are not related to object types. Make certain your students are aware of the distinction
between these terms.
......................................................................................................................................................
D-10 Oracle Developer: Build Forms II
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 by using a REF type.
Note: REF types are reviewed later.
......................................................................................................................................................
Oracle Developer: Build Forms II D-11
Appendix D: Introduction to Oracle8 Object Features
......................................................................................................................................................
Object Columns
......................................................................................................................................................
D-12 Oracle Developer: Build Forms II
Object Columns
......................................................................................................................................................
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 column.
Object columns are not assigned object IDs (OIDs), and therefore cannot be
referenced by using object REF values.
Note: Object REFs are reviewed later in this section.
......................................................................................................................................................
Oracle Developer: Build Forms II D-13
Appendix D: Introduction to Oracle8 Object Features
......................................................................................................................................................
Object Views
Object
Object-oriented Relational
view
application table
......................................................................................................................................................
D-14 Oracle Developer: Build Forms II
Object Views
......................................................................................................................................................
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, it would not convert all of the applications at once, but would
convert the applications one at a time.
This presents a problem. The applications that have been converted need the data
stored as objects, while 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 enables 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, while 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 by using Object REFs.
Note: Object REFs are reviewed later in this section.
Here is an example of an object view creation statement:
CREATE VIEW emp_view OF emp_type
WITH OBJECT OID (eno)
AS
SELECT e.empno, e.ename, e.sal, e.job
FROM emp e;
......................................................................................................................................................
Oracle Developer: Build Forms II D-15
Appendix D: Introduction to Oracle8 Object Features
......................................................................................................................................................
INSTEAD-OF Triggers
DECLARE
BEGIN
EXCEPTION
END;
......................................................................................................................................................
D-16 Oracle Developer: Build Forms II
INSTEAD-OF Triggers
......................................................................................................................................................
INSTEAD-OF Triggers
INSTEAD-OF triggers provide a transparent way of modifying views that cannot be
modified directly through SQL DML statements (INSERT, UPDATE, and DELETE).
These triggers are called INSTEAD-OF triggers because, unlike other types of
triggers, Oracle fires the trigger instead of executing the triggering statement. The
trigger performs update, insert, or delete operations directly on the underlying tables.
Users write normal INSERT, DELETE, and UPDATE statements against the view, and
the INSTEAD-OF trigger works invisibly in the background to make the right actions
take place.
INSTEAD-OF triggers are activated for each row.
Note: Although INSTEAD-OF triggers can be used with any view, they are typically
needed with object views.
......................................................................................................................................................
Oracle Developer: Build Forms II D-17
Appendix D: Introduction to Oracle8 Object Features
......................................................................................................................................................
References to Objects
OID
......................................................................................................................................................
D-18 Oracle Developer: Build Forms II
Referencing Objects
......................................................................................................................................................
Referencing Objects
Introduction
In relational databases, primary-key values are used to uniquely identify records. In
object-relational databases, OIDs provide an alternate method.
When a row in an object table or object view is created, it is assigned automatically 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.
Or 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 data type 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 data type:
CREATE TABLE o_emp
( empno NUMBER(4) NOT NULL,
ename VARCHAR2(10),
job VARCHAR2(10),
mgr NUMBER(4),
hiredate DATE,
sal NUMBER(7,2),
comm NUMBER(7,2),
dept REF dept_type SCOPE IS o_dept) ;
Note: The REF is scoped here to restrict the reference to a single table, o_dept. The
object itself is not stored in the table, only the OID value for the object is stored there.
......................................................................................................................................................
Oracle Developer: Build Forms II D-19
Appendix D: Introduction to Oracle8 Object Features
......................................................................................................................................................
Object Types in
Object Navigator
......................................................................................................................................................
D-20 Oracle Developer: Build Forms II
Displaying Oracle8 Objects in the Object Navigator
......................................................................................................................................................
Object Types
Both the attributes and the methods are listed under each type. Additionally, 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.
......................................................................................................................................................
Oracle Developer: Build Forms II D-21
Appendix D: Introduction to Oracle8 Object Features
......................................................................................................................................................
Object Tables
in Object Navigator
Object Columns
in Object Navigator
......................................................................................................................................................
D-22 Oracle Developer: Build Forms II
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. Additionally, the object table type name is
displayed in parentheses after the name of the object table.
Object Columns
Object columns are displayed with the object type in parentheses after the column
name, and with the attributes of the type indented underneath the column name.
......................................................................................................................................................
Oracle Developer: Build Forms II D-23
Appendix D: Introduction to Oracle8 Object Features
......................................................................................................................................................
Object Views
in Object Navigator
......................................................................................................................................................
D-24 Oracle Developer: Build Forms II
Displaying Oracle8 Objects in the Object Navigator
......................................................................................................................................................
Object Views
Object views are displayed like any other view, except that the object type they are
based on is written in parentheses after the view name.
INSTEAD-OF Triggers
You can create INSTEAD-OF database triggers through the trigger creation dialog
box, just as you would any other database trigger.
INSTEAD-OF INSERT, UPDATE, and DELETE triggers allow you to directly insert,
update, and delete against object views. They can also be used with any other type of
view that does not allow direct DML.
When a view has an INSTEAD-OF trigger, the code in the trigger is executed in place
of the triggering DML code.
......................................................................................................................................................
Oracle Developer: Build Forms II D-25
Appendix D: Introduction to Oracle8 Object Features
......................................................................................................................................................
Object REFs
in Object Navigator
......................................................................................................................................................
D-26 Oracle Developer: Build Forms II
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 underneath the
column or attribute.
......................................................................................................................................................
Oracle Developer: Build Forms II D-27
Appendix D: Introduction to Oracle8 Object Features
......................................................................................................................................................
Summary
This appendix covers the following
topics:
• Oracle8 introduced three new scalar
datatypes.
• Objects and object types allow
representation of complex data.
• Three kinds of objects are object tables,
object columns, and object views.
Summary
• INSTEAD-OF triggers allow DML on
object views.
• Object REFs store the object identifier
of certain types of objects.
• The Object Navigator can display
certain types of objects.
......................................................................................................................................................
D-28 Oracle Developer: Build Forms II
Summary
......................................................................................................................................................
Summary
New Oracle8 Data Types
Oracle8 introduced three new scalar data types and new composite data types 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.
......................................................................................................................................................
Oracle Developer: Build Forms II D-29
Appendix D: Introduction to Oracle8 Object Features
......................................................................................................................................................
......................................................................................................................................................
D-30 Oracle Developer: Build Forms II
E
................................
Menu Run-Time
Parameters
Appendix E: Menu Run-Time Parameters
......................................................................................................................................................
Objectives
......................................................................................................................................................
E-2 Oracle Developer: Build Forms II
Introduction
......................................................................................................................................................
Introduction
Overview
In this lesson, you will learn how to modify menus dynamically, as well as
how to control application security through menu access.
Objectives
After completing this lesson, you should be able to customize menu modules
by using substitution parameters.
......................................................................................................................................................
Oracle Developer: Build Forms II E-3
Appendix E: Menu Run-Time Parameters
......................................................................................................................................................
UN Current username
PW Current password
AD Directory name
TT Terminal type
LN Language used
User-Named Substitution
Parameters
Instructor Note
Demonstration: Open the Customized Menu demonstration (menu.mmb)
and select the print option. Show the code and the use of the UN and PW
substitution parameters.
......................................................................................................................................................
E-4 Oracle Developer: Build Forms II
Substitution Parameters
......................................................................................................................................................
Substitution Parameters
What Is a Substitution Parameter?
A substitution parameter is a two-character variable of type CHAR that is
referenced in a menu item command or in a PL/SQL program unit, and
substituted with a value at run time. A menu module provides some
predefined parameters, which automatically exist in every menu module.
You can also create in Form Builder (valid for a given menu module) your
own user-named parameters.
......................................................................................................................................................
Oracle Developer: Build Forms II E-5
Appendix E: Menu Run-Time Parameters
......................................................................................................................................................
Parameter Properties
--Name
Name
--Label
Label --Maximum
MaximumLength
Length
--Case
CaseRestriction
Restriction --Menu
MenuParameter
Parameter
--Conceal
ConcealData
Data Initial
Initial Value
Value
--Associated
AssociatedMenus
Menus --Required
Required
--Hint
Hint
Copyright Oracle Corporation, 1999. All rights reserved.
......................................................................................................................................................
E-6 Oracle Developer: Build Forms II
Defining a User-Named Substitution Parameter
......................................................................................................................................................
Property Description
Name The two-letter parameter name
Label The text prompt for the parameter value that is displayed in
the Enter Parameter Values dialog box
Case Restriction The property that converts the case of the user’s input to
either uppercase, lowercase, or none
Conceal Data The property that determines whether the user’s input is ech-
oed on the screen
Associated Menus All menu names where the parameter can be used (full-screen
menus only)
Maximum Length Value maximum length
Menu Parameter Initial Value The default value for the parameter; displayed in the parame-
ter value field when the Enter Parameter Values dialog box is
displayed
Required Mandatory or not; set Yes if the value is required or No to
allow the parameter value to be set to Null
Hint The text string displayed on the message line of the console
......................................................................................................................................................
Oracle Developer: Build Forms II E-7
Appendix E: Menu Run-Time Parameters
......................................................................................................................................................
Substitution Parameter
Built-ins
• QUERY_PARAMETER
• APPLICATION_PARAMETER
Instructor Note
You can prompt for several menu parameters by using the following syntax:
Query_Parameter(’&p1 &p2 &p3’);
......................................................................................................................................................
E-8 Oracle Developer: Build Forms II
Substitution Parameter Built-ins
......................................................................................................................................................
Example
This example invokes SQL*Plus and runs a command file (CF parameter).
PLUS80W &UN/&PW @&CF
Example
This example invokes Report Builder and enables the user to provide the
report name.
Query_Parameter(’&RN’);
Run_Product(reports, :RN, synchronous, runtime, filesystem, pl_id,
null);
......................................................................................................................................................
Oracle Developer: Build Forms II E-9
Appendix E: Menu Run-Time Parameters
......................................................................................................................................................
Validating Substitution
Parameter Values
MENU_SUCCESS function:
• Returns TRUE if the user does not
cancel the Enter Parameter Values
dialog box
• Is used in a WHILE loop
......................................................................................................................................................
E-10 Oracle Developer: Build Forms II
Validating a Substitution Parameter Value
......................................................................................................................................................
......................................................................................................................................................
Oracle Developer: Build Forms II E-11
Appendix E: Menu Run-Time Parameters
......................................................................................................................................................
Summary
......................................................................................................................................................
E-12 Oracle Developer: Build Forms II
Summary
......................................................................................................................................................
Summary
Substitution Parameters
• Using &UN, &PW, &AD, &SO, &TT, and &LN
• Creating user-named substitution parameters
• Programmatically controlling substitution parameters with
QUERY_PARAMETER and APPLICATION_PARAMETER
......................................................................................................................................................
Oracle Developer: Build Forms II E-13
Appendix E: Menu Run-Time Parameters
......................................................................................................................................................
......................................................................................................................................................
E-14 Oracle Developer: Build Forms II
F
................................
Handling Server-Side
Errors
Appendix F: Handling Server-Side Errors
......................................................................................................................................................
Objectives
After completing this appendix, you
should be able to:
• Handle server-side database errors
• Obtain the cause of declarative-
constraint violations
......................................................................................................................................................
F-2 Oracle Developer: Build Forms II
Introduction
......................................................................................................................................................
Introduction
Overview
This lesson covers the use of Oracle server features in Form Builder
applications. You will learn about handling Oracle server errors, including
declarative-constraint violations.
Objectives
At the end of this lesson, you should be able to:
• Handle errors raised by the Oracle server
• Obtain the cause of declarative-constraint violations
......................................................................................................................................................
Oracle Developer: Build Forms II F-3
Appendix F: Handling Server-Side Errors
......................................................................................................................................................
Instructor Note
Demonstration: Use the Handling of Server Errors (errh.fmb) file to
show the code for the STRIP_CONSTRAINT_NAME function. This
function forms part of the HANDLE_SERVER_ERROR procedure. Do not
talk through all of the code, because the HANDLE_SERVER_ERROR
procedure is covered later in this lesson.
Demonstration for next page pair: Use the Message (msg.fmb) file to
show how you can use your own message table to hold constraint messages.
Run the form and point out that two messages appear for foreign key
constraints.
Use the Handling of Server Errors (errh.fmb) file to show the code for
the STRIP_APPLICATION_ERROR function. This function is the form
part of the HANDLE_SERVER_ERROR procedure. Do not talk through all
the code, because the HANDLE_SERVER_ERROR procedure is covered
later in this lesson.
......................................................................................................................................................
F-4 Oracle Developer: Build Forms II
Obtaining the Cause of Declarative-Constraint Violations
......................................................................................................................................................
......................................................................................................................................................
Oracle Developer: Build Forms II F-5
Appendix F: Handling Server-Side Errors
......................................................................................................................................................
Technical Note
A foreign-key constraint violation can have two causes: “parent key not
found” or “child record found.” Therefore, two error messages are
associated with one foreign-key constraint name.
......................................................................................................................................................
F-6 Oracle Developer: Build Forms II
Customizing Oracle Server Error Messages
......................................................................................................................................................
......................................................................................................................................................
Oracle Developer: Build Forms II F-7
Appendix F: Handling Server-Side Errors
......................................................................................................................................................
Instructor Note
Demonstration: Use the Handling of Server Errors (errh.fmb) file to
show the code for the HANDLE_SERVER_ERROR procedure. This
procedure contains both functions already discussed.
......................................................................................................................................................
F-8 Oracle Developer: Build Forms II
Example Procedure for Handling Oracle Server Errors
......................................................................................................................................................
......................................................................................................................................................
Oracle Developer: Build Forms II F-9
Appendix F: Handling Server-Side Errors
......................................................................................................................................................
Technical Note
Error code 40508 is insert failed. Error code 40509 is update failed. Error
code 40510 is delete failed.
Instructor Note
Demonstration: Use the Handling of Server Errors (errh.fmb)
demonstration file to show the code for the HANDLE_FRM_ERROR
procedure. This procedure is called from the On-Error trigger.
Explanation for the next page pair: Remind students that all DDL operations
issue an implicit commit and end the current transaction. Form Builder is not
allowed to process any pending changes.
Stress that FORMS_DDL itself does not issue an implicit commit, but any
DDL statement can.
......................................................................................................................................................
F-10 Oracle Developer: Build Forms II
Example Procedure for Handling Oracle Server Errors
......................................................................................................................................................
......................................................................................................................................................
Oracle Developer: Build Forms II F-11
Appendix F: Handling Server-Side Errors
......................................................................................................................................................
Summary
......................................................................................................................................................
F-12 Oracle Developer: Build Forms II
Summary
......................................................................................................................................................
Summary
Handling Errors Raised by the Oracle Server
• Causes: Declarative constraints, database triggers, stored program units
• Trap implicit-DML errors by using DBMS_ERROR_CODE and
DBMS_ERROR_TEXT in an On-Error trigger
• Trap explicit DML errors and stored program unit errors by using
SQLCODE and SQLERRM in a WHEN OTHERS exception handler
......................................................................................................................................................
Oracle Developer: Build Forms II F-13
Appendix F: Handling Server-Side Errors
......................................................................................................................................................
......................................................................................................................................................
F-14 Oracle Developer: Build Forms II
G
................................
EMP_PKG Package
Appendix G: EMP_PKG Package
......................................................................................................................................................
Package Specification
/*******************************************************/
/* This is an example of a stored procedure that: */
/* query, insert, update, delete, and lock rows of the */
/* EMP table. */
/* A package is used to logically group the related */
/* data types and procedures */
/*******************************************************/
PACKAGE emp_pkg AS
......................................................................................................................................................
G-2 Oracle Developer: Build Forms II
Package Specification
......................................................................................................................................................
......................................................................................................................................................
Oracle Developer: Build Forms II G-3
Appendix G: EMP_PKG Package
......................................................................................................................................................
Package Body
PACKAGE BODY emp_pkg AS
/**************************/
/* QUERY USING REF CURSOR */
/**************************/
PROCEDURE empquery_refcur( block_data IN OUT empcur,
p_deptno IN NUMBER)
IS
BEGIN
OPEN block_data FOR
SELECT empno, ename, job, mgr, hiredate, sal, comm, deptno
FROM emp
WHERE deptno = NVL(p_deptno, deptno)
ORDER BY empno;
END;
. . .
......................................................................................................................................................
G-4 Oracle Developer: Build Forms II
Package Body
......................................................................................................................................................
/********************************/
/* QUERY USING TABLE OF RECORDS */
/********************************/
PROCEDURE empquery( block_data IN OUT emptab,
p_deptno IN NUMBER)
IS
i NUMBER;
CURSOR empselect IS
SELECT empno, ename, job, mgr, hiredate,
sal, comm, deptno
FROM emp
WHERE deptno = NVL(p_deptno, deptno)
ORDER BY empno;
BEGIN
OPEN empselect;
i := 1;
LOOP
FETCH empselect INTO block_data(i).empno,
block_data(i).ename,
block_data(i).job,
block_data(i).mgr,
block_data(i).hiredate,
block_data(i).sal,
block_data(i).comm,
block_data(i).deptno;
EXIT WHEN empselect%NOTFOUND;
i := i + 1;
END LOOP;
END;
. . .
......................................................................................................................................................
Oracle Developer: Build Forms II G-5
Appendix G: EMP_PKG Package
......................................................................................................................................................
/**********/
/* INSERT */
/**********/
PROCEDURE empinsert(block_data IN emptab)
IS
i NUMBER;
cnt NUMBER;
BEGIN
cnt := block_data.count;
FOR i IN 1..cnt
LOOP
INSERT INTO emp( empno, ename, job, mgr,
hiredate, sal, comm, deptno)
VALUES( block_data(i).empno, block_data(i).ename,
block_data(i).job, block_data(i).mgr,
block_data(i).hiredate, block_data(i).sal,
block_data(i).comm, block_data(i).deptno);
END LOOP;
END;
. . .
......................................................................................................................................................
G-6 Oracle Developer: Build Forms II
Package Body
......................................................................................................................................................
/**********/
/* UPDATE */
/**********/
PROCEDURE empupdate(block_data IN emptab)
IS
i NUMBER;
cnt NUMBER;
BEGIN
cnt := block_data.count;
FOR i IN 1..cnt
LOOP
UPDATE emp
SET ename = block_data(i).ename,
job = block_data(i).job,
mgr = block_data(i).mgr,
hiredate = block_data(i).hiredate,
sal = block_data(i).sal,
comm = block_data(i).comm,
deptno = block_data(i).deptno
WHERE empno = block_data(i).empno;
END LOOP;
END;
......................................................................................................................................................
Oracle Developer: Build Forms II G-7
Appendix G: EMP_PKG Package
......................................................................................................................................................
/**********/
/* DELETE */
/**********/
PROCEDURE empdelete(block_data IN empnotab)
IS
i NUMBER;
cnt NUMBER;
BEGIN
cnt := block_data.count;
FOR i IN 1..cnt
LOOP
DELETE FROM emp WHERE empno = block_data(i).empno;
END LOOP;
END;
/********/
/* LOCK */
/********/
PROCEDURE emplock(block_data IN empnotab)
IS
i NUMBER;
cnt NUMBER;
block_rec emprec;
BEGIN
cnt := block_data.count;
FOR i IN 1..cnt
LOOP
SELECT empno, ename, job, mgr,
hiredate, sal, comm, deptno
INTO block_rec
FROM emp
WHERE empno = block_data(i).empno
FOR UPDATE OF ename NOWAIT;
END LOOP;
END;
END;
......................................................................................................................................................
G-8 Oracle Developer: Build Forms II
Package Body
......................................................................................................................................................
To have an idea of how Form Builder works when a data block is based on a
stored procedure returning a REF CURSOR, you can run the following
script under Sql*Plus:
DECLARE
v_rec emp_pkg.emprec;
v_ref emp_pkg.empcur;
BEGIN
emp_pkg.emp_query_refcur(v_ref, 10);
LOOP
FETCH v_ref INTO v_rec;
EXIT WHEN v_ref%NOTFOUND;
DBMS_OUTPUT.PUT_LINE(v_rec.empno);
DBMS_OUTPUT.PUT_LINE(v_rec.ename);
DBMS_OUTPUT.PUT_LINE(v_rec.job);
DBMS_OUTPUT.PUT_LINE(v_rec.mgr);
DBMS_OUTPUT.PUT_LINE(v_rec.hiredate);
DBMS_OUTPUT.PUT_LINE(v_rec.sal);
DBMS_OUTPUT.PUT_LINE(v_rec.comm);
DBMS_OUTPUT.PUT_LINE(v_rec.deptno);
END LOOP;
CLOSE v_ref;
END;
......................................................................................................................................................
Oracle Developer: Build Forms II G-9
Appendix G: EMP_PKG Package
......................................................................................................................................................
......................................................................................................................................................
G-10 Oracle Developer: Build Forms II
H
................................
Objectives
......................................................................................................................................................
H-2 Oracle Developer: Build Forms II
Introduction
......................................................................................................................................................
Introduction
Overview
In this lesson, you will learn how to include and use ActiveX controls in
your Oracle Developer application.
Objectives
After completing this lesson, you should be able to do the following:
• Explain the differences between VBX, OCX, and ActiveX controls
• Access ActiveX properties at design time and run time
• Import ActiveX control methods and events packages
• Customize event handling
......................................................................................................................................................
Oracle Developer: Build Forms II H-3
Appendix H: Working with ActiveX Controls
......................................................................................................................................................
......................................................................................................................................................
H-4 Oracle Developer: Build Forms II
What Are VBX, OCX, and ActiveX Controls?
......................................................................................................................................................
What Is a VBX?
Short for Visual Basic custom control, a VBX is a reusable software
component designed for use in many different applications. While VBXs
can be used in other environments, they were initially created for developing
Windows applications with Visual Basic. An application developer can use a
number of selected VBXs to quickly develop an application.
What Is an OCX?
Short for OLE Custom control, an OCX is an independent program module
that can be accessed by other programs in a Windows environment. OCX
controls end with the .ocx extension. OCX controls represent Microsoft’s
second generation of control architecture, the first being VBX controls
written in Visual Basic.
What Is an ActiveX?
ActiveX controls are a superset of OLE Custom control (OCX). ActiveX is
an open platform that combines desktop and Web technologies. An ActiveX
control can be automatically downloaded and executed by a Web browser.
ActiveX is not a programming language, but rather a set of rules for how
applications should share information. Programmers can develop ActiveX
controls in a variety of languages, including C, C++, Visual Basic, and Java.
They represent Microsoft’s third generation of control architecture, the first
being VBX controls and the second OCX controls.
......................................................................................................................................................
Oracle Developer: Build Forms II H-5
Appendix H: Working with ActiveX Controls
......................................................................................................................................................
Web- No No Yes
enabled
Instructor Note
ActiveX will work on the Web, but not with Forms for the Web.
......................................................................................................................................................
H-6 Oracle Developer: Build Forms II
Comparison of VBX, OCX, and ActiveX Controls
......................................................................................................................................................
......................................................................................................................................................
Oracle Developer: Build Forms II H-7
Appendix H: Working with ActiveX Controls
......................................................................................................................................................
ActiveX controls:
• Dynamic library in .ocx files
• Support events, properties, and methods
ActiveX control item:
• Container for the ActiveX control
• Single-record property set to Yes
Instructor Note
The following ActiveX controls are included with demonstrations:
• Image: Display and image files in a variety of formats. Similar to the
Form Builder image item.
• Sound: Play and record sound clips. Similar to the Form Builder sound
item.
• Spreadtable: Spreadtable, or grid, control.
• Tabsheet: Tab controls. Provides more presentation options than the
Form Builder tab canvas but is more complex to implement.
• Video: Play video (AVI) files.
Each of these controls has its own help file describing its properties,
methods, and events. These help files are located in the
ORACLE_HOME\TOOLS\DOC60 directory. You can also view them from within
Form Builder.
These controls are provided for demonstration purposes only. They are not
supported by Oracle Corporation.
......................................................................................................................................................
H-8 Oracle Developer: Build Forms II
ActiveX in Form Builder
......................................................................................................................................................
......................................................................................................................................................
Oracle Developer: Build Forms II H-9
Appendix H: Working with ActiveX Controls
......................................................................................................................................................
Implementing an ActiveX
Control in Form Builder
1. Create an ActiveX Control Container.
2. Insert an ActiveX Control.
3. Import the desired ActiveX Control
methods and events.
4. Write the appropriate PL/SQL code.
Creating an ActiveX
Control Item
......................................................................................................................................................
H-10 Oracle Developer: Build Forms II
Implementing an ActiveX Control
......................................................................................................................................................
......................................................................................................................................................
Oracle Developer: Build Forms II H-11
Appendix H: Working with ActiveX Controls
......................................................................................................................................................
OLE
OLE Class
Class
Control
Control Properties
Properties
About
About Control
Control
Control
Control Help
Help
Technical Note
If you have created a container using the OCX button from the Layout
Editor, then Create Control is the only available option on the Insert Object
dialog box.
......................................................................................................................................................
H-12 Oracle Developer: Build Forms II
Inserting an ActiveX Control in an ActiveX Control Item
......................................................................................................................................................
......................................................................................................................................................
Oracle Developer: Build Forms II H-13
Appendix H: Working with ActiveX Controls
......................................................................................................................................................
2 6
- Program Units
+ PackageName1 (Spec)
3 + PackageName1 (Body)
+ ...
4 5
......................................................................................................................................................
H-14 Oracle Developer: Build Forms II
Importing ActiveX Control Methods and Events Packages
......................................................................................................................................................
......................................................................................................................................................
Oracle Developer: Build Forms II H-15
Appendix H: Working with ActiveX Controls
......................................................................................................................................................
Example
:item(′ActXitem’).OCX.Spindial.spindialctrl
:item( ′ActXitem’).OCX.Spindial.spindialctrl
.1.Needleposition:=:item(’ActXitem’).OCX.
.1.Needleposition:=:item(’ActXitem’).OCX.
Spindial.spindialctrl.1.Needleposition
Spindial.spindialctrl.1.Needleposition ++ 1;
1;
Copyright Oracle Corporation, 1999. All rights reserved.
......................................................................................................................................................
H-16 Oracle Developer: Build Forms II
Setting and Getting ActiveX Control Properties
......................................................................................................................................................
......................................................................................................................................................
Oracle Developer: Build Forms II H-17
Appendix H: Working with ActiveX Controls
......................................................................................................................................................
......................................................................................................................................................
H-18 Oracle Developer: Build Forms II
Setting and Getting ActiveX Control Properties
......................................................................................................................................................
......................................................................................................................................................
Oracle Developer: Build Forms II H-19
Appendix H: Working with ActiveX Controls
......................................................................................................................................................
MMVX_DMMVX.PLAY(:item
MMVX_DMMVX.PLAY(:item
((′video_ocx.video
′video_ocx.video′).INTERFACE);
′).INTERFACE);
......................................................................................................................................................
H-20 Oracle Developer: Build Forms II
Invoking ActiveX Control Methods
......................................................................................................................................................
Example
/* Getting a cell value from a Spread Table ActiveX control
using the GetCellByColRow method provided in the
SpreadTable package */
DECLARE
Cur_Row number;
Cur_Col number;
OLEObj OleObj;
BEGIN
Cur_Row:=SpreadTable.CurrentRow(:ITEM(’BLK.ITM’).interface);
Cur_Col:=SpreadTable.CurrentCol(:ITEM(’BLK.ITM’).interface);
OLEObj:=SpreadTable.GetCellByColRow(:ITEM(’BLK.ITM’).interface,
Cur_Col, Cur_Row);
END;
......................................................................................................................................................
Oracle Developer: Build Forms II H-21
Appendix H: Working with ActiveX Controls
......................................................................................................................................................
......................................................................................................................................................
H-22 Oracle Developer: Build Forms II
Responding to ActiveX Control Events
......................................................................................................................................................
Initialization Events
Initialization events for ActiveX controls do not fire in Forms run time.
These initialization events are intentionally disabled. Instead, you can use
When-New-Item-Instance or When-New-Record-Instance triggers in place
of the control’s native initialization events.
......................................................................................................................................................
Oracle Developer: Build Forms II H-23
Appendix H: Working with ActiveX Controls
......................................................................................................................................................
Handling Exceptions
Technical Note
The LAST_OLE_EXCEPTION built-in takes variables, not constants.
......................................................................................................................................................
H-24 Oracle Developer: Build Forms II
Handling Exceptions
......................................................................................................................................................
Handling Exceptions
FORMS_OLE_FAILURE Exception
When a failure is detected in handling an ActiveX control method, an FRM
message appears or the FORMS_OLE_FAILURE exception is raised. When
a FORMS_OLE_FAILURE exception is raised, you can get more detailed
information regarding the cause of the exception by calling the
LAST_OLE_EXCEPTION built-in.
/*
Handling the exception raised as a result of calling:
Var_To_Number(To_Variant(’Jane’));
An exception is raised because Jane is not a number.
*/
DECLARE
errCode PLS_INTEGER;
errSrc VARCHAR2(200);
errDescription VARCHAR2(2000);
errHelpfile VARCHAR2(200);
errHelpContext PLS_INTEGER;
BEGIN
. . .
WHEN form_ole_failure THEN
errCode := LAST_OLE_EXCEPTION(errSrc,
errDescription,
errHelpfile,
errHelpContext);
-- Inform the user of the problem
MESSAGE(errSrc||’;’||errDescription);
END;
......................................................................................................................................................
Oracle Developer: Build Forms II H-25
Appendix H: Working with ActiveX Controls
......................................................................................................................................................
......................................................................................................................................................
H-26 Oracle Developer: Build Forms II
Registering an ActiveX Control
......................................................................................................................................................
Supporting Files
Most ActiveX controls require a supporting DLL, such as the Microsoft
Foundation Class run-time library, mfc40.dll. The DLL must be in the
\WINDOWS\SYSTEM directory or in the search path. If the DLL is out of
date or missing, your ActiveX control will not register properly. Most
reputable ActiveX control suppliers provide documentation regarding the
version and name of the DLLs required; some even supply and install them
along with the ActiveX controls.
......................................................................................................................................................
Oracle Developer: Build Forms II H-27
Appendix H: Working with ActiveX Controls
......................................................................................................................................................
.
Summary
......................................................................................................................................................
H-28 Oracle Developer: Build Forms II
Summary
......................................................................................................................................................
Summary
In this lesson, you saw how to include and use ActiveX controls in your
Oracle Developer application.
• VBX, OCX, and ActiveX controls
• Differences between controls
• ActiveX control in Form Builder
• Create an ActiveX control
• Set and get ActiveX control properties
• Invoke ActiveX control methods
• Respond to ActiveX control events
• Register an ActiveX control
......................................................................................................................................................
Oracle Developer: Build Forms II H-29
Appendix H: Working with ActiveX Controls
......................................................................................................................................................
......................................................................................................................................................
H-30 Oracle Developer: Build Forms II
I
................................
• SESSION_ROLES
• ROLE_ROLE_PRIVS
• ROLE_SYS_PRIVS
• ROLE_TAB_PRIVS
......................................................................................................................................................
I-2 Oracle Developer: Build Forms II
Using Oracle Server Roles at Run Time
......................................................................................................................................................
SESSION_ROLES View
Roles that the user currently has enabled
Column Description
ROLE Name of the role
ROLE_ROLE_PRIVS View
Information about roles granted to other roles
Column Description
ROLE Name of the role
GRANTED_ROLE Role that was granted
ADMIN_OPTION Subprogram that signifies that the role was granted with the ADMIN
option
ROLE_SYS_PRIVS View
Information about system privileges granted to roles
Column Description
ROLE Name of the role
PRIVILEGES System privileges granted to the role
ADMIN_OPTION Column that signifies the grant was with the ADMIN option
......................................................................................................................................................
Oracle Developer: Build Forms II I-3
Appendix I: Using Oracle Server Roles at Run Time
......................................................................................................................................................
• SESSION_ROLES
• ROLE_ROLE_PRIVS
• ROLE_SYS_PRIVS
• ROLE_TAB_PRIVS
......................................................................................................................................................
I-4 Oracle Developer: Build Forms II
Using Oracle Server Roles at Run Time
......................................................................................................................................................
ROLE_TAB_PRIVS View
Information about table privileges granted to roles.
Column Description
ROLE Name of the role
OWNER Owner of the object
TABLE_NAME Name of the object
COLUMN_NAME Name of the column, if applicable
PRIVILEGE Object privilege granted to the role
GRANTABLE YES if the role was granted with the ADMIN option, otherwise NO
......................................................................................................................................................
Oracle Developer: Build Forms II I-5
Appendix I: Using Oracle Server Roles at Run Time
......................................................................................................................................................
• DBMS_SESSION.SET_ROLE
• DBMS_SESSION.IS_ROLE_ENABLED
......................................................................................................................................................
I-6 Oracle Developer: Build Forms II
Procedures for Managing Roles
......................................................................................................................................................
Example
The following Pre-Form trigger uses the DBMS_SESSION package to test a
user’s role before allowing access to the application.
IF not (DBMS_SESSION.IS_ROLE_ENABLED(’ADMINISTRATIVE’) or
(DBMS_SESSION.IS_ROLE_ENABLED(’TECHNICAL’)
THEN
MESSAGE(’You are not authorized to run this application’);
PAUSE;
RAISE form_trigger_failure;
END IF;
......................................................................................................................................................
Oracle Developer: Build Forms II I-7
Appendix I: Using Oracle Server Roles at Run Time
......................................................................................................................................................
......................................................................................................................................................
I-8 Oracle Developer: Build Forms II
J
................................
Instructor Note
Appendix J: Instructor Note
......................................................................................................................................................
Introduction
Project Builder is presented in Lesson 1. To help the students get familiar
with this tool, use it throughout the course.
A project named Oracle Developer: Build Forms II is provided, so that you can launch
all course demonstrations, PowerPoint slides, practice files, practice solutions, and the
final Summit application from Project Builder.
......................................................................................................................................................
J-2 Oracle Developer: Build Forms II
How the Project Is Organized
......................................................................................................................................................
Subproject Description
Instructor Contains all the demonstrations of the course. (Those
Demonstrations demonstrations are classified by lesson. Each lesson correspond to
a subsubproject.)
Instructor Slides Contains all the powerpoint slides of the course.
Practice Solutions Contains all the .fmb, .mmb files for the practice solutions
Start Forms Contains all the files (.tif, .ico, .fmb, ...) to start the practices
(Those files are similar to the one the students have.)
Summit Application Contains all the files (.tif, .ico, .fmb, ...) for the Summit
application (This application is similar to the one the students will
have after completing the Oracle Developer: Build Forms I and II
courses.)
......................................................................................................................................................
Oracle Developer: Build Forms II J-3
Appendix J: Instructor Note
......................................................................................................................................................
Project Setup
Importing the User Registry
1 Launch Project Builder.
The Welcome dialog box is displayed. Click the Cancel button.
2 Expand the User Registry node.
3 Delete all the entries (if any exist).
4 Select File––>Import Project.
The Import Options dialog box is displayed.
5 Click the Import types check box.
6 Click the Override existing types check box.
7 Click the Import button.
The Select File to Import dialog box is displayed.
8 From your course home directory, select the reg.upx file.
9 Click the Close button.
10 Expand the User Registry node and verify that the following types have
been imported:
- ICO File
- OLB File
- PPT File
- SQL File
- TIF File
......................................................................................................................................................
J-4 Oracle Developer: Build Forms II
Project Setup
......................................................................................................................................................
......................................................................................................................................................
Oracle Developer: Build Forms II J-5
Appendix J: Instructor Note
......................................................................................................................................................
......................................................................................................................................................
J-6 Oracle Developer: Build Forms II
Project Setup
......................................................................................................................................................
......................................................................................................................................................
Oracle Developer: Build Forms II J-7
Appendix J: Instructor Note
......................................................................................................................................................
Important Note
Whenever this book asks you to run a demonstration, it refers to the name of
the demonstration in Project Builder. By default, the demonstration will be
located in the subsubproject corresponding to the current lesson.
Enjoy your teaching!
......................................................................................................................................................
J-8 Oracle Developer: Build Forms II