Oracle Developer

:
Build Forms II
Volume 2 • Instructor Guide
.......................................................................................

44112GC10
Production 1.0
May 1999
M08752

Author

Copyright  Oracle Corporation, 1999. All rights reserved.

Mark Sullivan

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

Technical
Contributors and
Reviewers
Louise Barnfield
Gunnar Boehrs
Jacquelyn Bruce
Phyllis Chan
Bulent Cinarkaya
Laurent Dereac
Mark Doran
Gillian Elias
Tushar Gadhia
Stephen Gramann
Nancy Greenberg
Ursula Hovy
Uwe Jentzsch
Leta A. Johnson
Jan Keuben
Steve Lirette
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

Restricted Rights Legend
Use, duplication or disclosure by the Government is subject to restrictions for
commercial computer software and shall be deemed to be Restricted Rights
software under Federal law, as set forth in subparagraph (c) (1) (ii) of DFARS
252.227-7013, Rights in Technical Data and Computer Software (October 1988).
This material or any portion of it may not be copied in any form or by any means
without the express prior written permission of the Worldwide Education Services
group of Oracle Corporation. Any other copying is a violation of copyright law and
may result in civil and/or criminal penalties.
If this documentation is delivered to a U.S. Government Agency not within the
Department of Defense, then it is delivered with “Restricted Rights,” as defined in
FAR 52.227-14, Rights in Data-General, including Alternate III (June 1987).
The information in this document is subject to change without notice. If you find
any problems in the documentation, please report them in writing to Education
Products, Oracle Corporation, 500 Oracle Parkway, Box 659806, Redwood
Shores, CA 94065. Oracle Corporation does not warrant that this document is
error-free.
Oracle Developer, Oracle Server, and PL/SQL are trademarks or registered
trademarks of Oracle Corporation.
All other products or company names are used for identification purposes only,
and may be trademarks of their respective owners.

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

Preface
Profile xv
Related Publications xvi
Typographic Conventions xvii
Lesson 1: Managing Projects with Project Builder
Introduction 1-3
Introducing Project Builder 1-5
Project Builder Terminology 1-7
Project Builder Benefits 1-9
Project Builder User Interface 1-11
Project Builder User Interface 1-13
Creating Projects and Subprojects 1-15
Adding Project Files 1-17
Subdirectories Added as Subprojects 1-19
Creating Connections 1-21
Working with Project Files 1-23
Establishing Dependencies 1-25
Building Projects 1-27
Delivering Projects 1-29
Summary 1-33
Practice Session Overview: Lesson 1 1-35
Practice 1 1-36
Lesson 2: Creating a Menu Module
Introduction 2-3
Components of the Menu Module 2-5
The Default Menu 2-7
The Menu Editor 2-9
Creating a Menu Module 2-11
Module Properties 2-13
Menu Properties 2-15
Menu Item Properties 2-17
Menu Item Types 2-19

.....................................................................................................................................................
Oracle Developer: Build Forms II
iii

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

Menu Item Command Types 2-21
Implementing Menu Toolbars 2-23
Storing the Menu Module 2-25
Attaching the Menu Module 2-27
Pop-up Menus 2-29
Summary 2-31
Practice Session Overview: Lesson 2
Practice 2 2-34

2-33

Lesson 3: Managing Menu Modules
Introduction 3-3
Using PL/SQL in Menu Item Code 3-5
Useful Built-in Menu Subprograms 3-7
Showing and Hiding the Current Menu 3-9
Managing Menu Security 3-11
Defining Security Roles 3-13
Assigning Access to Menu Items 3-15
Summary 3-17
Practice Session Overview: Lesson 3 3-19
Practice 3 3-20
Lesson 4: Programming Function Keys
Introduction 4-3
Key Triggers 4-5
Defining Key Triggers 4-7
Characteristics of Key Triggers 4-9
Classification of Key Triggers 4-11
Using Key Triggers 4-15
Association with Other Interface Controls 4-17
Summary 4-19
Practice Session Overview: Lesson 4 4-21
Practice 4 4-22

.....................................................................................................................................................
iv
Oracle Developer: Build Forms II

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

Lesson 5: Responding to Mouse Events
Introduction 5-3
What Are Mouse Events? 5-5
Responding to Mouse Movement 5-7
Responding to Mouse Button Actions 5-11
Summary 5-17
Practice Session Overview: Lesson 5 5-19
Practice 5 5-20
Lesson 6: Controlling Windows and Canvases Programmatically
Introduction 6-3
Using Window-Interaction Triggers 6-5
Built-ins for Manipulating Windows 6-7
Built-ins for Manipulating Canvases 6-9
Working with Tab-Style Canvases 6-11
Windows and Blocks 6-15
Manipulating Window Properties Programmatically 6-17
Showing Multiple Windows 6-19
Closing Windows 6-21
Blocks with Many Items 6-23
Summary 6-25
Practice Session Overview: Lesson 6 6-27
Practice 6 6-28
Lesson 7: Defining Data Sources
Introduction 7-3
Data Source Types 7-5
Basing a Data Block on a FROM Clause Query 7-7
Basing a Data Block on a Stored Procedure 7-9
Example of a Query Using a REF Cursor Procedure 7-11
Example of Query Using a Table of Records Procedure 7-13
Example of DML Using a Stored Procedure 7-15
Deciding Whether to Use a REF Cursor or a Table
of Records 7-17

.....................................................................................................................................................
Oracle Developer: Build Forms II
v

............................................................................................Contents ...................... vi Oracle Developer: Build Forms II ..................................................................................... Data Block Wizard 7-19 Data Block Properties 7-21 Data Source Guidelines 7-23 Summary 7-27 Practice Session Overview: Lesson 7 Practice 7 7-30 7-29 Lesson 8: Working with Oracle8 Objects in Form Builder Introduction 8-3 What Are Object Types? 8-5 Review of Objects 8-7 Object REFs 8-9 Supported Oracle8 Features 8-11 How Oracle Developer Treats Objects 8-13 Object Type Displays 8-15 Creating Data Blocks Based on Oracle8 Objects 8-17 Selecting Object Table Columns 8-19 Selecting Object Column Attributes 8-21 Blocks with REF Lookups 8-23 The REF Column Value 8-25 LOVs for REFs 8-27 Summary 8-29 Practice Session Overview: Lesson 8 8-31 Practice 8 8-32 Lesson 9: Controlling Data Block Relationships Introduction 9-3 Creating a Relation 9-5 Block Coordination 9-7 Coordinate Blocks Using REFs 9-9 Characteristics of Relation-Handling Triggers 9-11 Principles of Relation-Handling Code 9-13 Obtaining Relation-Handling Information 9-15 Implementing a Coordination-Type Toggle 9-17 ....................................................................................................

................................................................................................................Contents .................................................................................................................................. Oracle Developer: Build Forms II vii ................... Forcing a Commit Per Master 9-19 Summary 9-21 Practice Session Overview: Lesson 9 Practice 9 9-24 9-23 Lesson 10: Building Multiple Form Applications Introduction 10-3 OPEN_FORM to Invoke Additional Forms 10-5 Closing Forms 10-7 Navigating Between Forms 10-9 Transaction Processing for Opened Forms 10-11 CALL_FORM to Invoke Additional Forms 10-13 Transaction Processing for Called Forms 10-15 NEW_FORM to Invoke Additional Forms 10-19 Controlling Open Forms and Called Forms Together Different Ways of Invoking Forms 10-23 Using Form Parameters 10-25 Parameter Lists 10-29 Creating and Manipulating Parameter Lists 10-31 Passing Data Between Forms 10-33 Summary 10-35 Practice Session Overview: Lesson 10 10-37 Practice 10 10-38 10-21 Lesson 11: Working with Record Groups Introduction 11-3 Record Groups 11-5 Using Record Groups 11-7 Defining Record Groups at Design Time 11-9 Built-in Functions for Controlling Record Groups 11-11 Defining Query Record Groups Programmatically 11-17 Defining Nonquery Record Groups Programmatically 11-19 Manipulating Record Group Rows 11-21 Manipulating Selected Record Group Rows 11-23 ......................................

................................................................................................ Defining Global Record Groups 11-25 Manipulating List Items Programmatically 11-27 Implementing Dynamic List Items 11-29 Adding Values to Combo Boxes 11-31 Summary 11-33 Practice Session Overview: Lesson 11 11-35 Practice 11 11-36 Lesson 12: Including Charts and Reports Introduction 12-3 Including Charts by Using the Chart Wizard 12-5 Chart Item Properties 12-11 Reporting Within Form Builder 12-13 Report Object Properties 12-15 Working with Reports 12-17 Summary 12-21 Practice Session Overview: Lesson 12 12-23 Practice 12 12-24 Lesson 13: Applying Timers Introduction 13-3 Timers 13-5 Handling Timer Expiration 13-7 Creating a Timer 13-9 Modifying a Timer 13-11 Deleting a Timer 13-13 Summary 13-15 Practice Session Overview: Lesson 13 Practice 13 13-18 13-17 Lesson 14: Using Server Features in Form Builder Introduction 14-3 Using Oracle Server Functionality in Forms 14-5 Dealing with PL/SQL Code 14-7 .....................................................................................................................Contents ......... viii Oracle Developer: Build Forms II .............................................................................

........................................................................................ PL/SQL8 Support 14-9 New PL/SQL8 Scalar Data Types 14-11 Unsupported Client-Side PL/SQL8 Features 14-13 Handling Errors Raised by the Oracle Server 14-15 Performing DDL with FORMS_DDL 14-19 Using FORMS_DDL 14-21 Summary 14-23 Practice Session Overview: Lesson 14 14-25 Practice 14 14-26 Lesson 15: Using Reusable Components Introduction 15-3 Reusable Components 15-5 Reusable Components List 15-7 The Calendar Class 15-11 Calendar Object Group Content 15-13 Built-in for Manipulating the Calendar 15-15 Summary 15-17 Practice Session Overview: Lesson 15 15-19 Practice 15 15-20 Appendix A: Practice Solutions Practice 1 Solutions A-2 Practice 2 Solutions A-5 Practice 3 Solutions A-9 Practice 4 Solutions A-12 Practice 5 Solutions A-16 Practice 6 Solutions A-18 Practice 7 Solutions A-21 Practice 8 Solutions A-25 Practice 9 Solutions A-29 Practice 10 Solutions A-34 Practice 11 Solutions A-36 Practice 12 Solutions A-42 .........................................................................................................................Contents ........................................................................ Oracle Developer: Build Forms II ix ..................

.... Practice 13 Solutions Practice 14 Solutions Practice 15 Solutions A-45 A-49 A-55 Appendix B: Table Descriptions and Data Summit Sporting Goods Database Diagram S_CUSTOMER Description B-3 S_CUSTOMER Data B-4 S_DEPT Description and Data B-8 S_EMP Description B-9 S_EMP Data B-10 S_ITEM Description B-13 S_ITEM Data B-14 S_ORD Description and Data B-16 S_PRODUCT Description B-17 S_PRODUCT Data B-18 S_REGION Description and Data B-22 S_TITLE Description and Data B-23 Oracle8 objects: types........................................................... x Oracle Developer: Build Forms II ....................................Contents ............................................................................................................................................................................ tables B-24 B-2 Appendix C: Project Builder Addendum Introduction C-3 Team Development with Project Builder C-5 Generating and Printing Project Reports C-11 Defining New Module Types C-13 Identifying New Module Types C-15 Describing New Module Types C-17 Actions for New Module Types C-19 An Icon for New Module Types C-21 Modifying Types Using Actions C-23 Customizing Actions by Using Macros C-25 Customizing the Launcher C-29 Inheritance in Project Builder C-31 Actions C-33 .............................

.............................................................................................................................................. Oracle Developer: Build Forms II xi .................... Summary C-35 Appendix D: Introduction to Oracle8 Object Features Introduction D-3 New Oracle8 Data Types D-5 Object Types D-7 Creating Oracle8 Objects D-11 Object Columns D-13 Object Views D-15 INSTEAD-OF Triggers D-17 Referencing Objects D-19 Displaying Oracle8 Objects in the Object Navigator D-21 Summary D-29 Appendix E: Menu Run-Time Parameters Introduction E-3 Substitution Parameters E-5 Defining a User-Named Substitution Parameter E-7 Substitution Parameter Built-ins E-9 Validating a Substitution Parameter Value E-11 Summary E-13 Appendix F: Handling Server-Side Errors Introduction F-3 Obtaining the Cause of Declarative-Constraint Violations F-5 Customizing Oracle Server Error Messages F-7 Example Procedure for Handling Oracle Server Errors F-9 Summary F-13 Appendix G: EMP_PKG Package Package Specification G-2 Package Body G-4 Appendix H: Working with ActiveX Controls Introduction H-3 .................................................................................................................Contents ........................

.................................. OCX............................ and ActiveX Controls H-7 ActiveX in Form Builder H-9 Implementing an ActiveX Control H-11 Inserting an ActiveX Control in an ActiveX Control Item H-13 Importing ActiveX Control Methods and Events Packages H-15 Setting and Getting ActiveX Control Properties H-17 Invoking ActiveX Control Methods H-21 Responding to ActiveX Control Events H-23 Handling Exceptions H-25 Registering an ActiveX Control H-27 Summary H-29 Appendix I: Using Oracle Server Roles at Run Time Using Oracle Server Roles at Run Time I-3 Procedures for Managing Roles I-7 Appendix J: Instructor Note Introduction J-2 How the Project Is Organized Project Setup J-4 Launching the Files J-8 J-3 ...... and ActiveX Controls? H-5 Comparison of VBX.............................................................. OCX.............................Contents ........................................................................... xii Oracle Developer: Build Forms II ................................................. What Are VBX....................

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

............... Tools––>Project Wizard b Name the project “Oracle Developer: Build Forms II”. a Using the Project Wizard....... Click Next to skip the Author and Comments fields.... 3 Create a subproject and add files to it.......... Practice 1 Solutions 1 Create a connection to the database............ Click Next to accept Oracle Developer: Build Forms II as the Parent Project..... password.................... Select Summit as the Pre-Defined Connection and click Next... Select Tools ––>Project Wizard in the main menu... File––>New––>Connection b Name the connection SUMMIT and specify the connect string..... Do not add files to this project. Enter the title. 2 Create an initial project......ico a .......... Select “Create an empty project” and click Finish.... Select Summit as the Pre-Defined Connection and click Next.. Click Next to skip the Author and Comments fields... Enter a Project Directory of the Lab subdirectory and click Next. Select the project node in the Project Navigator...... add: .................. Enter a Project Registry Filename of summit............. Enter Summit Application as the Title...........................Appendix A: Practice Solutions .calendar..... Enter a Title of Oracle Developer: Build Forms II............. username...... Select “Create a subproject under an existing project” and click Next.. and database.......... Your instructor should provide this information.... b From the labs directory................... and save it as summit....... Enter the Lab subdirectory as the Project Directory and click Next.... create a subproject named Summit Application that belongs to Oracle Developer: Build Forms II..........................pll .....tif .... Assign to this project the connection created earlier...upd in the Lab subdirectory and click Next...upd in the Lab directory... A-2 Developer/2000: Build Forms II ....copy. a Create a new project (use the Project Wizard).........................baseball.... Create a new connection...............

....... and use the Summit program group...Practice 1 Solutions .......... b Create Oracle Installer scripts on your local file system........ Name the Script Summit_Install. and click the Next button... Examine the Property Palette for the item and note that the Filename property has not changes............... a Invoke the Delivery Wizard and deliver all files...................olb pr11_2f...................sql Click Finish to accept “Select files to add to a project................ b Turn off the Show Implicit Items option..................... Developer/2000: Build Forms II A-3 ..... ............. Click the Next button to continue............... and click on the Next button............................. Do not ship the Oracle Developer Runtime environment with the installation............” The “Add Files to Project” dialog box appears. 5 Deliver the project... Select Tools––>Preferences––>Navigator and clear the Show Implied Items check box....... c Experiment with Project Builder’s different views......... 4 Explore the Project Navigator..... Select the name of the project from the list... Note that Project Builder has added executable versions of the Oracle source files that you added to the project...txt pr7_3a.. select the “Deliver all files” option.....fmb Form_Builder_II............ In the Project Navigator..............txt file and change the name of its entry to Delete Record Group Script. - customers. Select the different views under the Navigator menu. There is no formal solution...... enter the destination subdirectory......... Select Tools––>Deliver Wizard from the main menu..... Select the “Deliver locally and create Oracle Installer scripts” option.. select the pr11_2f.......... a Examine the state of the Project Navigator.... c Give a file items a more meaningful title....... Note what happens to the Project Navigator display............ Select the files and press Enter..................

........................................................... e Do not set any environmental variables upon installation................ Click the Next button to accept the default list of files............ Select the Lab_Sol subdirectory and click the OK button................ Click the Finish button.. c .... d Accept the default delivery directories....... In the Project Navigator......... Using the Project Wizard.......................................... f Verify the settings. select Project––> Add Directory to Project.............. Click the Next button to continue............... create a subproject named Lab_Sol that belongs to Oracle Developer: Build Forms II .....Appendix A: Practice Solutions ........ Include all the deliverable files in the project............. 6 Create a subproject from a subdirectory and add files to it.................................. Click the Next button to accept the default delivery directories.. select the name of the project that you just created.. and finish the delivery......... If you have time................... Automatically include all files in that subdirectory....... From the menu........ A-4 Developer/2000: Build Forms II ..................

.... Click New Item twice to obtain the text cursor....... Practice 2 Solutions 1 Create a new menu module...... Invoke the Menu Editor.......... Set the properties as follows: ............................... Erase the old name................ This automatically creates the main menu.................................................................... a Using the following screenshot as a guideline................................................ Click the Create Down tool.............. Change the name........ Enter the name: File...................... Click File.. Select the Menus node in the Object Navigator and click the Create tool......... Developer/2000: Build Forms II A-5 .Practice 2 Solutions . Change the name of the menu to MAIN_MENU............................ Rename the menu item New Item to File.... Create new menu items under File.. create a new menu module called M_SUMMIT...................................

...................... Click the File menu item.................... Menu Toolbar Icon Filename DO_KEY(’CO MMIT_FORM’ )............ and each its menu items......... These will be needed in a later exercise................................ • • File Menu Visible in Menu Visible in Horiz.... Yes Yes Abort Yes Yes Yes Yes No Yes Label Menu Item Type Command Type Menu Item Code Save Plain PL/SQL Clear Plain PL/SQL Null1 Separator Null Exit Plain PL/SQL Null2 Separator Null DO_KEY( ’EXIT_FORM ’)........... For each of the items.......................... Create a new menu item to the right of File and rename it Edit... Click the Create Right tool......................... Create new menu items under Edit................ Exit Note the exact names of the Main Menu............................ Click Edit.......................... A-6 Developer/2000: Build Forms II ................ Menu Toolbar Icon Filename Cut Magic Cut Null Yes Yes Cut Copy Magic Copy Null Yes Yes Copy ....................... Click the Create Down tool.... Yes Yes Save DO_KEY(’ CLEAR_FORM ’).Appendix A: Practice Solutions ... set the properties as follows: Edit Menu Label Menu Item Type Magic Item Command Type Visible in Menu Visible in Horiz....... Name the new menu item Edit......................... Change the name.....

’customer_id’ ) . See the previous solution........ order_by.................. ’id’ ) ................ Click Sort By................ order_by................ Developer/2000: Build Forms II A-7 ................ Click the Create Right tool................................. Customer Id Radio Order_By PL/SQL SET_BLOCK_PROPERTY( ’s_ord’.................................. Click Edit........ See the previous solution.................. Sales Rep Id Radio Order_By PL/SQL SET_BLOCK_PROPERTY( ’s_ord’................. • Label Menu Item Type Magic Item Command Type Visible in Menu Visible in Horiz..... order_by........ Rename the new menu item Sort By.. Set the properties as follows: .. Menu Toolbar Icon 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.......... Menu Item Code Create a new menu to the right of Sort By and rename it Query.Practice 2 Solutions ............. Click the Create Down tool........ Set additional properties as follows: Sort By Menu Menu Label Menu Item Type Menu Item Radio Group Command Type Order Id Radio Order_By PL/SQL SET_BLOCK_PROPERTY( ’s_ord’.... Change the name.......... Create three new menu items under Sort By.... ’sales_rep_id’ ) ................... Create two new menu items under Query....................................

Click the right mouse button and select Copy...................................... Yes execute Label Menu Item Code Save as M_SUMMIT and compile the menu module.................... Yes query eXecute Query Plain PL/SQL DO_KEY(’EXECUT E_QUERY’)............. b Copy the EDIT_MENU menu from the M_SUMMIT menu module to the CUSTOMERS form............. a Open the CUSTOMERS form module........ c Attach the menu module to the ORDERS form........ 2 Add pop-up menus to the CUSTOMERS form.............. b ........ Open the ORDERS form and set the Menu Module property to M_SUMMIT for the form module................................................................................. • Query Menu Visible in Horiz....................... c Save and compile the form module.... Select this pop-up menu in the Popup Menu property for the Comments item........... Attach this pop-up menu to the Comments item.......... e Run and test the ORDERS form....................... d Save and compile the form module.........Appendix A: Practice Solutions .. Menu Toolbar Icon Filename Menu Item Type Command Type Enter Query Plain PL/SQL DO_KEY(’ ENTER_QUERY’)....... Select EDIT_MENU from the M_SUMMIT menu module.... Select the Pop-up Menus node from the CUSTOMERS form module.... A-8 Developer/2000: Build Forms II ............... Click the right mouse button and select Paste....

image_activate’.............. END IF.......image_description’).. CHECKED.... DISPLAYED...... image_button_id ITEM := FIND_ITEM(’control...... SET_MENU_ITEM_PROPERTY(’image_menu.............. .............image_activate’............ See previous solution.........txt file........... b Create a new menu item under Image and name it Image Activate....... ’Image On’)........ PROPERTY_TRUE )...........Practice 3 Solutions .... SET_ITEM_PROPERTY( image_description_id.......... See previous solution..... PROPERTY_TRUE ).... LABEL... SET_ITEM_PROPERTY(image_button_id.. PROPERTY_FALSE )..... DISPLAYED...... SET_ITEM_PROPERTY(image_description_id..... image_description_id ITEM := FIND_ITEM(’s_item.... CHECKED. DISPLAYED....................... Open the M_SUMMIT menu module and create a new menu item to the right of Query and rename it Image. select File->Import Text...... SET_MENU_ITEM_PROPERTY( ’image_menu....... DECLARE product_image_id ITEM := FIND_ITEM(’s_item..... SET_ITEM_PROPERTY( image_button_id...displayed) = ’TRUE’ THEN SET_ITEM_PROPERTY( product_image_id. ’Image Off’). PROPERTY_FALSE ).... PROPERTY_TRUE )............txt file...... Set the properties as follows: a Menu Label Menu Item Type Command Type Image Activate Check PL/SQL c Import the text for the Image Activate menu item by using the pr3_1c................ PROPERTY_FALSE).......product_image’ )... Practice 3 Solutions 1 Define a check menu item... LABEL. BEGIN IF GET_ITEM_PROPERTY(product_image_id........image_button’ ). Developer/2000: Build Forms II A-9 ... Import the H:\Lab\pr3_1c. ELSE SET_ITEM_PROPERTY(product_image_id...... The menu item name must be IMAGE_ACTIVATE......... In the PL/SQL Editor.... DISPLAYED...........................................

...... Save and compile the menu module.... PROPERTY_TRUE )..............IMAGE_ACTIVATE’...................................... You may need to change the code to conform to the exact names you gave to the Main Menu and its menu items.....IMAGE'.............. 2 Synchronize the menu module with the form.... END......... and use the SET_MENU_ITEM_PROPERTY built-in procedure to disable these options.CURRENT_FORM variable to get the name of the current form...... SET_MENU_ITEM_PROPERTY('MAIN_MENU........ END IF........... 3 The menu items Sort By and Image are not relevant to the CUSTOMERS form and therefore should have no effect...IMAGE_BUTTON'.......IMAGE_BUTTON’.......... Open the CUSTOMERS form and set the Menu Module property to M_SUMMIT for the form module..... e Run and test the ORDERS form........ ENABLED.. LABEL) ='Image Off' ... LABEL) =’Image Off’ THEN SET_MENU_ITEM_PROPERTY(’IMAGE_MENU........ You can replace the exisiting code with the code from the pr3_3b. Use the SYSTEM.. PROPERTY_FALSE)......... b Modify the startup code of the M_SUMMIT menu module to disable these options when the CUSTOMERS form is opened.. b IF :SYSTEM. PROPERTY_FALSE).. Use the Startup Code menu module property to invoke the PL/SQL Editor.. A-10 Developer/2000: Build Forms II ................ a Attach the menu module to the CUSTOMERS form.Appendix A: Practice Solutions .... Remove the existing code and replace with the following code... You can import the pr3_2a.............. ENABLED.......txt file.... a Write startup code for the M_SUMMIT menu module that synchronizes the Image Activate menu item with the Image button........................CURRENT_FORM = 'CUSTOMERS' THEN SET_MENU_ITEM_PROPERTY('MAIN_MENU.................... ELSIF GET_ITEM_PROPERTY('CONTROL................ CHECKED.SORT_BY'... d IF GET_ITEM_PROPERTY(’CONTROL..... Save and compile your module...................................txt file.

......................................Execute a Query and click the Orders button to move to the ORDERS form.................. Save and compile the module... PROPERTY_TRUE ).................. and that they are enabled when the ORDERS form is current........................................... THEN SET_MENU_ITEM_PROPERTY(’IMAGE_MENU........ Note that the Sort By and Image menu items are disabled when the CUSTOMERS form is current.............. d Run the CUSTOMERS form and test your application.IMAGE_ACTIVATE’.........................Practice 3 Solutions ......... CHECKED..................................... Developer/2000: Build Forms II A-11 ..................................................... c ....................................... END IF.....

.. Open the ORDERS form module and replace the M_SUMMIT menu module with the DEFAULT&SMARTBAR menu..item_id := NULL.................................. generate.................. b Run the form and make sure that you understand the default behavior of [Duplicate Record]....price := NULL.. This code should be executed in addition to and after the form level code..............product_id := NULL............... c Redefine [Duplicate Record] so that a new record is created before the record duplication occurs.... 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...... d In the S_ORD block..Appendix A: Practice Solutions .... description....... :s_item... f Save......id := NULL............................ and price items are emptied after duplication....... ...... Set the Execution Hierarchy property for this trigger to After..... This code should be executed in addition to and after the form level code................ redefine [Duplicate Record] in such a way that the Id item is emptied after duplication............ Set the Execution Hierarchy property for this trigger to After............................ and test the ORDERS form. A-12 Developer/2000: Build Forms II ................. Key-Duprec on the S_ITEM Block :s_item. :s_item......... product_id..... e In the S_ITEM block.. Key-Duprec on the S_ORD Block :s_ord................... Redefine [Duplicate Record] at the form level..description := NULL....... DUPLICATE_RECORD.............. If you have time....... a Key-Duprec at Form Level CREATE_RECORD........ :s_item.......... Practice 4 Solutions 1 Create and modify a key trigger..... redefine [Duplicate Record] in such a way that the item_id....

.............. a Make sure that only the function keys [Duplicate Record]....... Key-CreRec on the S_ORD Block CREATE_RECORD........ You cannot exit the form by selecting the [Exit] key in the master block.... Key-Entqry on the S_ORD Block ENTER_QUERY... [Clear Block]. All function keys should be available for the S_ITEM detail block........... and [Down] can be used for the S_ORD master block.......... 2 Disable function keys. Key-ClrBlk on the S_ORD Block CLEAR_BLOCK.......... Key-Exeqry on the S_ORD Block EXECUTE_QUERY..... b Test whether you can exit from the form by selecting the [Exit] key in the master block.......... [Execute Query].... [Create Record]........ Key-Others on the S_ORD Block MESSAGE(’Function Not Allowed’)... [Up]............................................................. Key-Down on the S_ORD Block DOWN................. ........Practice 4 Solutions .................................. Developer/2000: Build Forms II A-13 ...................................................... [Enter Query]............................................. Key-Up on the S_ORD Block UP.

....................................EXIT_BUTTON item to activate the same functionality when you select the [Exit] function key..... IF SHOW_ALERT(’question_alert’) = ALERT_BUTTON1 THEN EXIT_FORM ... DO_KEY(’exit_form’)...............Appendix A: Practice Solutions ....... Key-Exit at Form Level SET_ALERT_PROPERTY(’question_alert’.......... Forms searches at a higher level for such a key trigger... c Add a form-level Key-Exit trigger to perform the exit functionality of the CONTROL.. When-Button-Pressed on the CONTROL.................................. If there is no key trigger defined for a function key at the same level as Key-Others......................... ’Do you really want to leave the form?’).............. Explain this behavior........ e Modify the When-Button-Pressed trigger of the CONTROL.....................EXIT_BUTTON item....... ................ ALERT_MESSAGE_TEXT................... d Test again whether you can exit from the form by selecting [Exit] in the master block..................... END IF.......................... A-14 Developer/2000: Build Forms II ......................... Remove the existing code................EXIT_BUTTON Item Remove the existing code and replace with the following code.....

................. IF SHOW_ALERT(’DELETE_ALERT’) = ALERT_BUTTON1 THEN DELETE_RECORD...Practice 4 Solutions ..... c Specify new text to be displayed in the run-time Show Keys help window.... In the Key-Delrec on the S_ORD block...... Create an alert called DELETE_ALERT. a Key-Delrec on the S_ORD Block SET_ALERT_PROPERTY(’DELETE_ALERT’.......... depending on the block where the cursor is.. Developer/2000: Build Forms II A-15 ........................ IF SHOW_ALERT(’DELETE_ALERT’) = ALERT_BUTTON1 THEN DELETE_RECORD......................... END IF................. set the Keyboard Help Text trigger property to “Remove Line Item” and set the Display in Keyboard Help property to Yes.. Key-Delrec on the S_ITEM Block SET_ALERT_PROPERTY(’DELETE_ALERT’.......................................... b For the S_ORD and S_ITEM blocks...... END IF...... ALERT_MESSAGE_TEXT.................... .. In the Key-Delrec on the S_ITEM block.......................... 3 Create and modify a key trigger.............. ALERT_MESSAGE_TEXT................................... Modify the message displayed............................ redefine [Delete Record] so that the alert is displayed when a record is deleted.. ’Do you want to delete this order?’)........... set the Keyboard Help Text trigger property to “Remove Order” and set the Display in Keyboard Help property to Yes.... ’Do you want to delete this line item?’)..........

.... This should occur only when the mouse is in the CV_ORDER canvas.........SHOW_HELP_BUTTON........................................... Set Bevel to none......... this item appears as S.....COMMENTS that invokes the item’s editor when the user double-clicks the item... 2 In the ORDERS form convert the CONTROL.. define a When-Mouse-Enter trigger at form level that assigns a value of ? to the display item CONTROL............ A-16 Developer/2000: Build Forms II .................... you provide additional functionality in your forms by defining mouse-event triggers....................... Set the font size to 24......... define a mouse-event trigger on S_CUSTOMER..MOUSE_CANVAS = ’CV_ORDER’ THEN :control.... Practice 5 Solutions In this practice...................... WHEN-MOUSE-DOUBLECLICK on s_customer................. WHEN-MOUSE-ENTER at Form Level IF :SYSTEM....... The item’s background color should match the toolbar.. . Change the item type property and choose a font that allows large character sizes (such as Times New Roman)........... and its text color should be green....SHOW_HELP_BUTTON button into a display item capable of displaying a single large character.....................show_help_button := ’?’......................comments EDIT_TEXTITEM................................... Since only the first character of the item name is visible in the Layout Editor. END IF...Appendix A: Practice Solutions ......... Adjust the item size so that one character is visible inside it......... There is no formal solution.... 3 In the ORDERS form........ 1 In the CUSTOMERS form......

SHOW_HELP_BUTTON that uses the SHOW_VIEW built-in to display the CV_HELP..............show_help_button SHOW_VIEW(’cv_help’).. WHEN-MOUSE-LEAVE trigger on control.... If you have time. WHEN-MOUSE-LEAVE trigger on control.CURSOR_ITEM.. even if the current item is obscured.... SHOW_VIEW(’cv_help’)..... 6 Save. You might decide to advertise Help only while the cursor is in certain items....HIDE_HELP_BUTTON button........ GO_ITEM(:GLOBAL..save_item_name)........ 5 Create a When-Mouse-Leave trigger on CONTROL................ WHEN-MOUSE-ENTER trigger on control.........Practice 5 Solutions ............................ Ensure............. 4 Create a When-Mouse-Enter trigger on CONTROL...txt and pr5_7_2....SHOW_HELP_BUTTON that hides the CV_HELP.......... if appropriate...................txt files.... Use the HIDE_VIEW built-in to achieve this.................... and run the ORDERS form to test.................. ...... Remove the When-Button-Pressed trigger................... The CV_HELP canvas. Developer/2000: Build Forms II A-17 ..show_help_button HIDE_VIEW(’cv_help’)..... compile.................................id’)... GO_ITEM(’s_ord...... or move the stacked canvas to a position that does not overlay enterable items.............. The stacked canvas.. that the first entered item in the form is CV_HELP will not obscure..... of course. could also be shown in its own window...show_help_button :GLOBAL..... at least.save_item_name := :SYSTEM... WHEN-MOUSE-ENTER trigger on control. You can replace the existing code with the code from the pr5_7_1. 7 Modify the When-Mouse-Enter and When-Mouse-Leave triggers to display the Cv_Help canvas............. Delete the CONTROL......show_help_button HIDE_VIEW(’cv_help’). CV_HELP is displayed only if the current item is not obscured...............

.................... Next.. Create a When-New-Form-Instance trigger.. You can import the pr6_1b........Appendix A: Practice Solutions .... Practice 6 Solutions 1 Manipulate a multiple-window form........ END IF..... If cursor navigation succeeds............WIDTH_<window_name> and GLOBAL.......EVENT_WINDOW = ’WIN_ORDER’ THEN DO_KEY(’exit_form’).. A-18 Developer/2000: Build Forms II ...... Save.................... Also make sure that when a user closes the inventory window by way of the system-menu box... Create a When-Window-Resized trigger that calls the procedure......................txt file... a When-Window-Closed Trigger at Form Level IF :SYSTEM...... the form is exited............ the cursor navigates to the orders window....... There is no formal solution........... and test the form........................ Create a WhenWindow-Closed trigger............. d Make sure that a user cannot make any window larger than it was at the startup of the form.............txt file...EVENT_WINDOW = ’WIN_INVENTORY’ THEN GO_BLOCK(’s_ord’)..........HEIGHT_<window_name> c .......... You can replace the existing code with the code from the pr6_1d1...................txt file...... the inventory window should closed. b Make sure that when a user closes the orders window by way of the system-menu box..... The following solution assumes that the window sizes at form startup are stored in global variables with names of the general form: GLOBAL.. and create a procedure called CHECK_WINDOW_SIZE that resets the size of the current window if the new width and height are larger than the initial one.................... You can import the code from the pr6_1d2.......... compile........... ELSIF :SYSTEM.... create the procedure CHECK_WINDOW_SIZE........ You should save the size of the windows at the startup of the form........ Open the ORDERS form module.......

.................... END IF... it is better to use form parameters than global variables........ HEIGHT)..... WIDTH)............ Note: In multiple-form applications..width_win_inventory := GET_WINDOW_PROPERTY(’win_inventory’..... v_window_max_height ).. v_window_max_width )......................... HEIGHT............. WIDTH) ) THEN SET_WINDOW_PROPERTY(p_window......... END check_window_size...........width_win_order := GET_WINDOW_PROPERTY(’win_order’... When-New-Form-Instance Trigger at Form Level EXECUTE_QUERY..... because form parameters are not visible to other forms.... . BEGIN v_window_max_width := NAME_IN(’GLOBAL.............. Developer/2000: Build Forms II A-19 ..... HEIGHT) ) THEN SET_WINDOW_PROPERTY(p_window.............width_’ || p_window )........ :GLOBAL.....................height_win_order := GET_WINDOW_PROPERTY(’win_order’................. v_window_max_height := NAME_IN(’GLOBAL...... :GLOBAL... IF v_window_max_height < TO_NUMBER( GET_WINDOW_PROPERTY(p_window.. WIDTH...WIDTH). IF v_window_max_width < TO_NUMBER( GET_WINDOW_PROPERTY(p_window............Practice 6 Solutions ........ v_window_max_heightNUMBER............... :GLOBAL........... :GLOBAL... HEIGHT). PROCEDURE check_window_size( p_window IN VARCHAR2 ) IS v_window_max_widthNUMBER............. END IF...........height_win_inventory := GET_WINDOW_PROPERTY(’win_inventory’........... When-Window-Resized Trigger at Form Level check_window_size( :SYSTEM...........height_’ || p_window )..EVENT_WINDOW ).................

.help_tab := ’Displays ’|| Initcap(:SYSTEM........ ELSE SET_TAB_PAGE_PROPERTY(’CANVAS2.. and use the CONTROL............................. SET_WINDOW_PROPERTY( forms_mdi_window. 3 Open the EMPLOYEES form................................................. WINDOW_STATE............ change its label to Employee XX. If you have time... When-Tab-Page-Changed Trigger at Form Level :control............. c Modify the When-Tab-Page-Changed trigger to change the label on the Comment tab page... Open the CUSTOMERS form module.... You can import the pr6_3c..ID)........... TITLE....... ’Employee ’ || :EMP...id)... .. A-20 Developer/2000: Build Forms II .............Appendix A: Practice Solutions ...... and display an appropriate title........... When Comment is the topmost page.. maximize the MDI application window. change the label back to Comment. ’Summit Sporting Goods Application’).........help_tab := ’Displays ’|| Initcap(:SYSTEM. You can import the pr6_3a... a Create a When-Tab-Page-Changed trigger to populate this item with an appropriate message for each page........txt file........COMMENT’.. a When-New-Form-Instance Trigger at Form Level SET_WINDOW_PROPERTY( forms_mdi_window...................HELP_TAB text item to display a hint or description for the current tab page.............. where XX is the employee’s ID number (emp... LABEL....TAB_NEW_PAGE) || ’ information about ------------------>’ .. MAXIMIZE ). b When-Tab-Page-Changed Trigger at Form Level :control... IF :SYSTEM......TAB_NEW_PAGE) || ’ information about ------------------>’ .. Test and verify your module................................ When any other tab page is topmost... 2 Manipulate the MDI application window...... You can import the pr6_2b. LABEL... END IF.txt file..txt file...... ’Comment’)........... b At the startup of the form.......COMMENT’..TAB_NEW_PAGE = ’COMMENT’ THEN SET_TAB_PAGE_PROPERTY(’CANVAS2...

... b Set the Query Data Source Type EMP block property to From Clause Query........ This ROWID value is used in the WHERE clause of any subsequent UPDATE. In the EMP block Property Palette.... REGION_ID... START_DATE................................................ USERID..... or SELECT FOR UPDATE statements issued by Oracle Forms............. DEPT_ID................ d................... When a block’s Query Data Source Type is From Clause Query.... COMMENTS. SALARY.................ID....... Your query should return all the columns from the S_EMP table joined with the columns from the S_DEPT table... change Query Data Source Type to From Clause Query..... Developer/2000: Build Forms II A-21 . the ROWID of each row is implicitly queried when the row is retrieved from the database.. TITLE.. The SELECT statement is: a (SELECT e. Therefore. the ROWID .... the ROWID value is not implicitly retrieved.....dept_id = d..................... under the Database node...... Open the EMPLOYEES form module................................id) d When a block’s Query Data Source Type is Table............. DELETE..... Practice 7 Solutions 1 Base the EMP block on a subquery.........txt file..... s_dept d WHERE e............................. LAST_NAME........ COMMISSION_PCT... You can copy and paste the content of the pr7_1c......... NAME FROM s_emp e.........ID NUM.. Remember to enclose your select SELECT statement in parentheses...... c In the Query Data Source Name property enter the SELECT statement..Practice 7 Solutions .. MANAGER_ID. FIRST_NAME...

.. set the Query Only property to Yes................................ On-Update. A-22 Developer/2000: Build Forms II ................. Use SQL*Plus to run the file.. e Save............ b Prevent Oracle Forms from attempting to update the columns from the S_DEPT table. value cannot be used in subsequent statements.. Oracle Forms constructs the WHERE clause using the primary key values of each row.... 2 Enable DML on the EMP block without using transactional triggers................ Using the code in the pr7_3a............ There is no formal solution........... updates.................... and test your module....... and test your module.. Remove the On-Insert............... On the Property Palette for the item... If you have time.... or use the Stored Procedure editor in Forms and copy and paste the code from the file..... Instead..........fmb module... and the Update Allowed and Insert Allowed properties to No for the S_DEPT items (NUM.. under the Advanced Database node. d Save.. or deletes)............ .... a Set the block DML Target Name. Set the Primary Key property for the Id item to Yes......... 3 Create a server-side package containing a procedure to return a REF cursor........................... 4 Modify the Ord_Sum block in the ord_sum....... In the EMP block Property Palette... Configure the EMP block so that Oracle Forms will use the primary key values when constructing the WHERE clause.. REGION_ID).............. run......sql file in your labs directory....... a Open the ord_sum......... and On-Lock triggers..... c Remove the appropriate transactional triggers... Change the Query Data Source Type of the Ord_Sum block to Procedure... run.................. Set the KeyMode property for the EMP block to Updatable.. NAME.......... Set the Enforce Primary Key property for the EMP block to Yes. change DML Data Target Name to S_EMP.. create the Orders package body and package specification.. Change the DML Data Target Type to None (this block does not allow any inserts...Appendix A: Practice Solutions ......fmb module to base it on the stored procedure.. On-Delete....

........ These arguments should match the arguments to the package procedure.... Now the cursor remains in the Ord_Sum block and there is no need to code the Go_Block statement.. Hint: You need to execute a query in the Ord_Sum block...... The second argument is used to pass the value of the list box (:Choose..... d Specify the procedure arguments... b Set the Query Data Source Name to the name of the stored procedure in the package.... Under the Advanced Database node.. change Query Source Name to ORDERS_PKG............... Varchar2(255) TOTAL.....Practice 7 Solutions .............................. The arguments are: Argument Type Type Name Mode Value Resultset RefCursor (No Value) In Out (No Value) P_View Varchar2 (No Value) In :Choose. change Mouse Navigate to No.................. Alternative Method: In the Choose...... Number There is no formal solution. Add a When-List-Changed trigger to Choose.... change Query Data Source Type to Procedure....QUERY_PROC............................. Developer/2000: Build Forms II A-23 ......View_Type Property Palette......... c Specify the Query Data Source Columns to match the items in the Ord_Sum block.........View_Type 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................. You can find the procedure name by double-clicking the package body name under the Stored Program Units node in the Object Navigator. The column names and types are: ID.............................. The first argument is the REF cursor that will be used by Forms to populate the block.. EXECUTE_QUERY.... Number NAME....... .......... under the Database node.....View_Type as follows:\ GO_BLOCK(’ord_sum’).......................View_Type) to the procedure to determine which SELECT statement is used..................... Under the Database node.............. In the Ord_Sum block Property Palette.... change DML Data Target Type to None......................

............................................ 5 Save and run your form....................... What do you deduce from this behavior? The record count increments as Forms fetches more records................................ From this we can deduce that a block based on a REF Cursor stored procedure benefits from array fetches..................Appendix A: Practice Solutions ......... Observe the behavior of the record count in the console and the scroll bar as you scroll through the records........................... and the scroll bar button changes size as more records are fetched...... A-24 Developer/2000: Build Forms II ........................................................................................................................... ....................... just like a block based directly on a table..

......... a ...... Create a new form called OO_DEPT.... Select all available items for display............ and use a tabular layout with three displayed records and a scroll bar....) Select OO_DEPT_TABLE and click the OK button............................... you are asked to supply connect information...... 2 Create a block based on a relational table with an object column............. (If you are not currently connected to the database................. c Finish following the Data Block Wizard and invoke the Layout Wizard....... Click the Next button to use a new content canvas.............. Click the Next button to base the new block on a table.............. Select the Tabular option button and click the Next button to specify a tabular layout........ Base the block on the object table OO_DEPT_TABLE. Select Forms in the Object Navigator and click the Create button.... and include all the columns............... a Create a form called OBJ_COL. Click the Finish button to create the block and to invoke the Layout Wizard........ Select Forms in the Object Navigator and click the Create button..... Click the Browse button to view a list of tables...... Change the Records Displayed value to 3. b Create a block by using the Data Block Wizard..... There is no formal solution...................Practice 8 Solutions ..... Developer/2000: Build Forms II A-25 . and select the Display Scrollbar check box.......... Do not enforce data integrity. then the Finish button.. d Test and save the form....... Select Data Blocks in the Object Navigator and click the Create button.......... Select the newly created form name and change it to OO_DEPT................. Click the Next button to accept the default prompts.. Click the OK button to use the Data Block Wizard..... Practice 8 Solutions 1 Create a block based on a relational table..... Do not enter a frame title............ Select the newly created form name and change it to OBJ_COL...................... Click the >> button and Next button to select all the available columns.......... Click the >> button and the Next button to select all available items for display.............. Click the Next button...

... Click the OK button to use the Data Block Wizard.. c Finish following the Data Block Wizard and invoke the Layout Wizard............... e Test and save the form..... 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................. Select all available items for display............................. Use a form layout. Do not enter a Frame Title.......... A-26 Developer/2000: Build Forms II ... Do not enforce data integrity.... Later......... Repeat the process for the NAME attribute................................ 3 Create a block based on a relational table with an REF column and an LOV to populate the REF column.... FIRST_NAME................... Repeat the process for the DEPT_ID_NAME item.................... Select Data Blocks in the Object Navigator and click the Create button. Change the prompt for item DEPT_ID to Department ID and DEPT_ID_NAME to Department Name.....Appendix A: Practice Solutions . Select the ID column and click the > button....... Click the Next button to specify a form layout................ Click the Next button to continue.. d Examine the properties for the item dept_id_name.. Do not enter a frame title............ Click the Next button to continue.......... Expand the object column DEPT_ID and select the attributes ID and NAME..... Repeat this process for the FIRST_NAME and LAST_NAME columns... Click the Next button to base the new block on a table... Click the Finish button......... Click the Next button to use a new content canvas.......... you will compare and contrast these properties with the properties set for a REF column. Select REL_EMP_TABLE_OBJCOL and click the OK button.... There is no formal solution.. and LAST_NAME........... Select the ID attribute and click the > button.. Click the Browse button to view a list of tables.. b ... Expand the DEPT_ID object column to display the objects attributes.... Base the block on the relational table REL_EMP_TABLE_OBJCOL. Click the Finish button to create the block and to invoke the Layout Wizard.. There is no formal solution.................... Finish following the wizard...... Click the next button to accept the default records displayed........ Select the columns ID...... Note the name that is given to the new item. Pay particular attention to the database properties...... Create a block by using the Data Block Wizard...

... Select the dept_id check box........... a b c d e Create a form called REF_COL... The second represents the REF column value itself................ Base the block on the relational table REL_EMP_TABLE_REFCOL..... Repeat the process for the name attribute..... button... Select all available items for display. select the OO_DEPT_TABLE table and click the OK button... Select Forms in the Object Navigator and click the Create button... FIRST_NAME and LAST_NAME. Do not enter a frame title........ (Do not select the second DEPT_ID item...... Select REL_EMP_TABLE_REFCOL and press the OK button................................ so by default the REF item is assigned to the Null canvas................ Repeat that process for the first name and last name columns......... Select “Data Blocks” in the Object Navigator and press the Create button.. Select the newly created form name and change it to REF_COL.............. Press the Next button to base the new block on a table.................. Click the Next button to continue...... Select the check box.............. Press the .. Click the Next button to continue....) Expand the dept_id object column to display the object attributes... Developer/2000: Build Forms II A-27 ......... Finish following the Data Block Wizard and invoke the Layout Wizard..) ........ Note that there are two items called DEPT_ID................................... REF item values are normally not displayed......... The first is expandable and has the term “LOOKUP” in parenthesis after the name.. Do not enforce data integrity.. The Data Block Wizard offers to create an LOV for the REF item dept_id.................. The REF item is included automatically when the LOV is created......Practice 8 Solutions ... Expand the first DEPT_ID item and select the attributes ID and NAME. Press the Browse button to view a list of tables. Select the columns ID... Press the OK button to use the Data Block Wizard. Create a block by using the Data Block Wizard. Select the id attribute and click the > button.............. (Note that the REF item DEPT_ID is included in the list of items in the Object Navigator but is not included in the list of available items in the Layout Wizard.................................. Select the id column and press the > button.... and select OO_DEPT_TABLE as the source for the LOV.

........... A-28 Developer/2000: Build Forms II ............... including the LOV.... Use a form layout.. There is no formal solution........ Do not enter a Frame Title.......... g Select the item DEPT_ID from the Object Navigator................ Finish following the wizard...... Click the >> button and the Next button to select all available items for display... f Examine the database properties for the item DEPT_ID_NAME.... notice that an LOV and associated record group now exist........ There is no formal solution.......Appendix A: Practice Solutions ......................... Click the Finish button to create the block and to invoke the Layout Wizard.................. Change the prompt for item dept_id_id to Department Id and dept_id_name to Department Name. Click the Next button to use a new content canvas...... and examine the Canvas property.. Pay particular attention to the database properties...... There is no formal solution........................ Also.......... h Test and save the form....... ............................................................................................................. Notice that the Query Only property is set to Yes..................

........................................... b Run the ORDERS form and test the way deletes are handled............................................................................ 2 Implement a query coordination-type toggle............ ......................................................... a Note the deletion and coordination property values................................................................Practice 9 Solutions ... Practice 9 Solutions 1 Open the ORDERS form and examine the properties of the relation called S_ORD_S_ITEM................... a Add two check boxes to the control block with the following properties: Property Check Box 1 Check Box 2 Name IMMEDIATE AUTO_QUERY Enabled Yes No Label Immediate Auto Query Value When Checked Y Y Value When Unchecked N N Check Box Mapping of Other Value CHECKED UNCHECKED Keyboard Navigable No No Mouse Navigate No No Data Type CHAR CHAR Initial Value Y Y DataBase Item No No Canvas TOOLBAR TOOLBAR b Use the Layout Editor to position the checkboxes appropriately in the Toolbar canvas...................... Developer/2000: Build Forms II A-29 ..........

............ END IF...... When-Checkbox-Changed on CONTROL........... 3 Add a detail block based on a REF relation to the OO_DEPT table. ELSE SET_RELATION_PROPERTY(’s_ord_s_item’................. There is no formal solution... AUTOQUERY ) = ’FALSE’ THEN SET_RELATION_PROPERTY(’s_ord_s_item’.................................... There is no formal solution........ DEFERRED_COORDINATION ) = ’FALSE’ THEN SET_RELATION_PROPERTY(’s_ord_s_item’.... ENABLED.Appendix A: Practice Solutions ..... AUTOQUERY.............. DEFERRED_COORDINATION...... SET_ITEM_PROPERTY(’control. A-30 Developer/2000: Build Forms II ........... END IF......auto_query’.....AUTO_QUERY IF GET_RELATION_PROPERTY(’s_ord_s_item’... a Open the OO_DEPT form in the Object Navigator........txt file..... c Make sure that the first check box enables a user to toggle between immediate coordination and deferred coordination... DEFERRED_COORDINATION..... When-Checkbox-Changed on CONTROL... PROPERTY_TRUE ).. d Make sure that the second check box enables a user to toggle between automatic query and no automatic query for the detail block.txt file................. e ...... You can import the pr9_2c.......... ENABLED... PROPERTY_FALSE )...auto_query’. SET_ITEM_PROPERTY(’control............ PROPERTY_TRUE)..................... ELSE SET_RELATION_PROPERTY(’s_ord_s_item’..................IMMEDIATE IF GET_RELATION_PROPERTY( ’s_ord_s_item’.......... PROPERTY_FALSE)................ If you have time. PROPERTY_FALSE).................. This check box should be disabled if the other check box indicates immediate coordination.... You can import the pr9_2d... AUTOQUERY............ PROPERTY_TRUE ). Test and save the form.........

...... Click the Next button to use the existing content canvas.... Click the Next button to base the new block on a table.. c Create a relationship between the two blocks using the REF value............ (If you are not currently connected to the database....... Click the Next button to continue.. Select the Tabular option button and click the Next button to specify a tabular layout.. Click the Finish button to create the block and to invoke the Layout Wizard..... Select all available items for display......) Select OO_EMP_TABLE_REFCOL and click the OK button...... There is no formal solution..... e Test and save the form.. (In the display. Do not enforce data integrity...... Click the Next button... Click the Browse button to view a list of tables. you are asked to supply connect information.... the entry DEPT_ID without the word Lookup after it represents the dept_id REF column......... and include the id........ Select Data Blocks in the Object Navigator and click the Create button........... Select the id column and click the > button... d Finish following the Data Block Wizard and invoke the Layout Wizard... Select the block OO_DEPT_TABLE and click the OK button........ first_name. last_name....... and do not create an LOV.... Click the Next button to accept the default prompts... then the Finish button.. and dept_id REF columns..................Practice 9 Solutions . Do not specify a frame title.. Click the OK button to use the Data Block Wizard.................................... 4 Synchronize the check boxes at form startup..... and dept_id REF columns... Click the Next button to continue............... Change the Records Displayed value to 3................... Developer/2000: Build Forms II A-31 .... This procedure synchronizes the IMMEDIATE and AUTO_QUERY b ............... Click the >> button and the Next button to select all available items for display... Click the Create Relationship button................... Create a new block by using the Data Block Wizard... Repeat the process for the first_name.......... last_name.. b Create a procedure called INIT_RELATION_CHECK_BOXES. and use a tabular layout with three displayed records and a scroll bar.................................. Base the block on the table REL_EMP_TABLE_REFCOL........ a Open the ORDERS form module........ and select the Display Scrollbar check box......

WIDTH). AUTOQUERY) = ’TRUE’ THEN :control... ELSE :control. :GLOBAL. A-32 Developer/2000: Build Forms II ..auto_query := ’N’............. :GLOBAL......txt file.......txt file...........immediate := ’Y’........... Change the Menu Module property to DEFAULT&SMARTBAR............... check boxes with the current default value....height_win_inventory := GET_WINDOW_PROPERTY(’win_inventory’.. END IF.......... SET_ITEM_PROPERTY(’control... b Create a procedure called CHECK_DEL_CUS.............. SET_ITEM_PROPERTY(’control....... 5 Implement foreign-key delete rules.......... c Call this procedure from the When-New-Form-Instance trigger.............. :GLOBAL... ENABLED..... a PROCEDURE check_del_cus ( p_cus_id IN NUMBER ) .................... You can import the pr9_5b.. :GLOBAL.. PROPERTY_TRUE ).............. ELSE :control........auto_query’.....width_win_order := GET_WINDOW_PROPERTY(’win_order’....... HEIGHT).......... END IF.......height_win_order := GET_WINDOW_PROPERTY(’win_order’......Appendix A: Practice Solutions .... END. PROCEDURE init_relation_check_boxes IS BEGIN IF GET_RELATION_PROPERTY(’s_ord_s_item’'.. PROPERTY_FALSE)... This procedure displays an error message as soon as a user tries to delete a customer for which matching orders exist...... You can import the pr9_4b...... Open the CUSTOMERS form module.....auto_query’.....HEIGHT)......immediate := ’N’.......auto_query := ’Y’........ init_relation_check_boxes... IF GET_RELATION_PROPERTY(’s_ord_s_item’.......... DEFERRED_COORDINATION) = 'FALSE' THEN :control. ENABLED........... EXECUTE_QUERY..... WIDTH)............width_win_inventory := GET_WINDOW_PROPERTY(’win_inventory’............................

. ........... IF c_ord%FOUND THEN CLOSE c_ord...................................................... ELSE CLOSE c_ord.................... RAISE ord_exists...... FETCH c_ord INTO v_dummy.’).................................. IS CURSOR c_ord IS SELECT ’X’ FROM s_ord WHERE customer_id = p_cus_id........................................ RAISE FORM_TRIGGER_FAILURE........ DELETE_RECORD... BEGIN OPEN c_ord. END IF.............. v_dummy VARCHAR2(1)..................... and run the module........ Key-Delrec Trigger on S_CUSTOMER Block check_del_cus(:s_customer............. Developer/2000: Build Forms II A-33 ... c Call the procedure when a user selects the delete function key. ord_exists EXCEPTION..........Practice 9 Solutions .......... d Save................id)................... END check_del_cus............. EXCEPTION WHEN ord_exists THEN MESSAGE(’Cannot delete customer while matching orders exist...... compile........

d In the Object Navigator....................Change the Mouse Navigate property of CONTROL. Replace the existing code with the code in the pr10_1e... NO_HIDE.........EMPLOYEE_BUTTON Item DECLARE p_list_id PARAMLIST................. a In the control block of the CUSTOMERS form.. TEXT_PARAMETER... END ...... A-34 Developer/2000: Build Forms II ...........txt file........ ADD_PARAMETER( p_list_id........... p_list_id )... The type of this parameter is TEXT_PARAMETER... ....................................................EMPLOYEE_BUTTON that calls the EMPLOYEES form with the current sales representative ID......... c Pre-Query Trigger on the EMP Block . ’sales_id’. and it is initialized with the value of the SALES_REP_ID item..... Open the EMPLOYEES form module.. END IF.. p_list_id := CREATE_PARAMETER_LIST(’sales’). BEGIN IF NOT ID_NULL( GET_PARAMETER_LIST( ’sales’ ) ) THEN DESTROY_PARAMETER_LIST(’sales’)..... NO_QUERY_ONLY.. b Define a trigger for CONTROL... .................. TO_CHAR( :s_customer.... Practice 10 Solutions 1 Produce a multiple form application by linking the CUSTOMERS and the EMPLOYEES forms...............................Invoke the EMPLOYEES form by using the CALL_FORM built-in........................ below the Orders button......... create a parameter called SALES_ID. e Add a trigger to ensure that queries on the employee block are restricted by the value of the SALES_ID parameter.Appendix A: Practice Solutions ...Create a parameter list called SALES........EMPLOYEE_BUTTON to No........sales_rep_id )).... . .... DO_REPLACE.. create a button called EMPLOYEE_BUTTON.Add the SALES_ID parameter to the parameter list...txt file....... You can import the pr10_1b... When-Button-Pressed on the CONTROL........................ Place it on the CV_CUST canvas.... CALL_FORM(’employees’...

.. Key-Commit Trigger at Form Level: EMPLOYEES Form IF GET_APPLICATION_PROPERTY( CALLING_FORM ) IS NULL THEN COMMIT_FORM......................... You can import the pr10_2b....... Developer/2000: Build Forms II A-35 .... Key-Exit Trigger at Form Level: EMPLOYEES Form EXIT_FORM( ASK_COMMIT........sales_id IS NULL THEN :emp...sales_rep_id.. then run the CUSTOMERS form module........... NO_ROLLBACK )..................... b Make sure that when the CUSTOMERS form calls the EMPLOYEES form. ’GLOBAL....sales_rep_id IS NOT NULL AND :PARAMETER..............sales_rep_id’). If you have time............................ ELSE :emp..................Practice 10 Solutions .... 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...................................................... [Commit] performs a post.......................sales_id. ... c Save and compile each form.num := :PARAMETER..txt file....... ELSE POST......... f Save and compile each form....... END IF...num := :GLOBAL.. then run the CUSTOMERS form module and test your application........................... DEFAULT_VALUE(’’....................... IF :GLOBAL.... END IF........ Test the application by exiting the EMPLOYEE form using the menu or the toolbar....

b Create a design time query record group that contains IDs and names of departments..... PROCEDURE List_From_DesignTime_Group (p_list_item IN VARCHAR2) IS cst_rg_nom CONSTANT VARCHAR2( 30 ) := GET_ITEM_PROPERTY(p_list_item................ Combo Box Style.. ............... Practice 11 Solutions 1 Create a dynamic list item......... COPY( GET_LIST_ELEMENT_VALUE( p_list_item.............. You can import the pr11_1e...... a Open the EMPLOYEES form module.. This functionality avoids having to create a new item to display the department name.....txt file.. This procedure accepts the list item name as an argument and populates the list item dynamically at runtime........ c Convert the text item DEPT_ID into a list item.. p_list_item).................................. In the Object Navigator..........Appendix A: Practice Solutions ... using the design-time query record group.. There is no formal solution...................1 ).. TO_CHAR(id) Id FROM s_dept ORDER BY 1 There is no formal solution................. e Create a procedure called LIST_FROM_DESIGNTIME_GROUP..................... BEGIN IF POPULATE_GROUP( cst_rg_nom ) = 0 THEN POPULATE_LIST( p_list_item.................................... Resize it in the Layout Editor........... END IF......... A-36 Developer/2000: Build Forms II ...... There is no formal solution....... Label: Dummy and Value: 0 There is no formal solution.. create a record group named DEPT_ID based on the query below: SELECT name || ’ in region ’ || TO_CHAR(region_id) Name............ cst_rg_nom )..................... END List_From_DesignTime_Group............. Name your record group DEPT_ID..... d Create an element in the list......... ITEM_NAME ).....

c Examine this new module and save it as lov_product.... and SUGGESTED_WHLSL_PRICE columns are displayed..... If you have time...... loop through each item in the record to keep the visual attribute from being highlighted................. g Save.. Write the code to create a record group if it does not already exist and add columns to the group for each item in the PROD_LOV_BLK block................. You can import the pr11_1f. If the record group exists write the code to retrieve the internal ID for each column in the record group......... Only the ID...... This practice shows how to create a list of values where the user can select multiple values............ This form also contains an OK button and a Cancel button without any code.fmb.............. Write the code to check whether the record selected is already in the record group... When-Create-Record Trigger on the EMP Block....... b Run Form Builder and create a new form based on a template named lov_prod_template......... compile..... 2 Create a multirecord select list form........... d Create a When-Mouse-Click trigger at the PROD_LOV_BLK block level that selects or clears a record when a user presses Controlclicks for a product. This form contains two visual attributes called DESELECTED and SELECTED.................... If so. and then remove the record from the record group........................ write the code to add the record to the record group and loop through each ........txt file..... If the user selects a record that was not already in the group............ CLEAR_LIST(’EMP.. LIST_FROM_DESIGNTIME_GROUP(’EMP......DEPT_ID’)...... and test the module..fmb...... a Exit Form Builder... Developer/2000: Build Forms II A-37 .................................... f Call the procedure each time a new record is created.....Practice 11 Solutions ......................... This new form contains a multi-record block based on the S_PRODUCT table........DEPT_ID’)..................... NAME............. There is no formal solution.... This lab uses a global record group.

..... CHAR_COLUMN.. A-38 Developer/2000: Build Forms II .... prodprice_id := FIND_COLUMN(’sel_records.........’recno’......... -.. BEGIN -IF :SYSTEM........If record group does not exist -.. .. prodname_id GROUPCOLUMN........’prodno’.column in the record group ELSE recno_id := FIND_COLUMN(’sel_records...if the record group does exist -............... itm VARCHAR2(80)..... Use the SELECTED and DESELECTED visual attributes in your code to change the color of a selected or cleared record....................prodno’)....... END IF....................... 80)...... recno_id := ADD_GROUP_COLUMN(rg_id... prodno_id := ADD_GROUP_COLUMN(rg_id.........prodprice’).... prodprice_id GROUPCOLUMN........retrieve the internal id for each -.. prodname_id := FIND_COLUMN(’sel_records..................group for each item in the PROD_LOV_BLK IF ID_NULL(rg_id) THEN rg_id := CREATE_GROUP(’sel_records’..NUMBER_COLUMN)...Appendix A: Practice Solutions ..... desel VARCHAR2(5) := ’no’................recno’)... no_rows NUMBER(7)........... When-Mouse-Click Trigger on the PROD_LOV_BLK Block DECLARE rg_id RECORDGROUP := FIND_GROUP(’sel_records’).......... prodno_id := FIND_COLUMN(’sel_records..’prodprice’.MOUSE_BUTTON_MODIFIERS = ’Control+’ THEN -.. NUMBER_COLUMN)............. prodprice_id := ADD_GROUP_COLUMN(rg_id..... prodno_id GROUPCOLUMN.. item in the block to keep the color highlighted.......................NUMBER_COLUMN).........txt file..............prodname’)...... prodname_id := ADD_GROUP_COLUMN(rg_id. recno_id GROUPCOLUMN..’prodname’........ lst VARCHAR2(100).. GLOBAL_SCOPE).....create it and add columns to the -...... You can import the pr11_2d...................

........’ || itm.... SET_GROUP_NUMBER_CELL(prodprice_id..in the block to set the visual -.......... SET_GROUP_NUMBER_CELL(recno_id.......suggested_whlsl_price)......check to see if record CNTL -.... :prod_lov_blk........ DELETE_GROUP_ROW(rg_id. END IF...... END LOOP...........no_rows LOOP IF TO_NUMBER(:SYSTEM.............CURSOR_BLOCK..record group no_rows := GET_GROUP_ROW_COUNT(rg_id)........name)..CURSOR_BLOCK || ’.... itm := GET_BLOCK_PROPERTY(:SYSTEM.... no_rows+1.. IF desel != 'yes' THEN ADD_GROUP_ROW(rg_id.....CURSOR_BLOCK ............to be highlighted for each...was not already in the group -..if CNTL click on a record that -.... no_rows+1......end_of_group). TO_NUMBER(:SYSTEM...... SET_GROUP_CHAR_CELL(prodname_id......... -...... END LOOP...... no_rows+1..... FOR i IN 1.................... :prod_lov_blk..clicked on is already in the record -.. i) THEN desel := ’yes’.......’ || itm.....group ...... .. itm := GET_ITEM_PROPERTY(itm.... itm := GET_BLOCK_PROPERTY( :SYSTEM..............MOUSE_RECORD)). ’DESELECTED’).....id).....attribute back from being highlighted..................Practice 11 Solutions ....add the record to the record group -.. i).. Developer/2000: Build Forms II A-39 ......CURSOR_BLOCK || ’..... -.and then remove record from -...... -...if so loop thru each item -............ NEXTITEM).... itm := :SYSTEM.. :prod_lov_blk...... FIRST_ITEM)...item in the block to set the color -...... EXIT WHEN itm IS NULL...and loop through each -. LOOP DISPLAY_ITEM(itm. itm := :SYSTEM..........MOUSE_RECORD) = GET_GROUP_NUMBER_CELL(recno_id............ no_rows+1.. EXIT............ FIRST_ITEM ). SET_GROUP_NUMBER_CELL(prodno_id..

.......... END LOOP................... itm := :SYSTEM... g In the ORDERS form.. A-40 Developer/2000: Build Forms II . e Create the code for the OK button........................CURSOR_BLOCK || ’....CANCEL_PB Item IF NOT ID_NULL(FIND_GROUP(’sel_records’)) THEN DELETE_GROUP(’sel_records’).......’ || itm....... passing the list of existing products using a GLOBAL variable. This button enables the user to exit the form....... END IF.............. so that products already ordered do not show up in the list....... NEXTITEM)........RECORD_STATUS != ’NEW’ THEN LOOP :GLOBAL.......CURSOR_BLOCK || ’.. The new code should check the existing products in the S_ITEM block. itm := GET_ITEM_PROPERTY(itm..PRODUCT_LOV_BUTTON..... You can import the pr11_2g..... Create a When-Button-Pressed trigger that deletes the record group before returning to the ITEM block..... DO_KEY(’EXIT_FORM’).. FIRST_RECORD.’ || itm. ....txt file.. LOOP DISPLAY_ITEM(itm.. GO_BLOCK(’item’)....... ’SELECTED’). END IF..... When-Button-Pressed Trigger at PROD_LOB_BLK.............. END..... modify the When-Button-Pressed trigger for the CONTROL........................ EXIT WHEN itm IS NULL..................... The trigger then calls the PROD_LOV_BLK form...where_cls := :GLOBAL.............. itm := :SYSTEM.txt file.................. f Create the code for the Cancel button in the PROD_LOV_BLK block.......product_id)... You can import the pr11_2f............ :GLOBAL.....................where_cls || TO_CHAR(:item............. END IF..... IF:SYSTEM.Appendix A: Practice Solutions ........where_cls := ’ id NOT IN (’... DO_KEY(’EXIT_FORM’)......

..... When-New-Form-Instance Trigger at Form Level DEFAULT_VALUE(’’. ’'GLOBAL............ :GLOBAL............’ || TO_CHAR(:item.txt file.... Place the new code after the existing code.........txt file.You can import the pr11_2i.....................’'..... :GLOBAL..............where_cls)... You should use the global variable created earlier....... and test your forms. NO_HIDE)....where_cls := :GLOBAL..... END LOOP... i j In the ORDERS form........ NEXT_RECORD...... END IF...... the code creates records in the S_ITEM block for each row selected in the record group.......where_cls || ’.. EXIT WHEN :SYSTEM............. DEFAULT_WHERE.where_cls’)........LAST_RECORD = ’TRUE’...... hold the Control key down.. After you call the form.............product_id) || ’)’.........where_cls := :GLOBAL...... You can import the pr11_2h.... create a When-New-Form-Instance trigger to retrieve the list of products excluding the products that exist in the S_ITEM block........ CALL_FORM(’lov_product’.. SET_BLOCK_PROPERTY(’prod_lov_blk’. Developer/2000: Build Forms II A-41 ....... and then select other items...... run..............where_cls || ’.... To select multiple items............Practice 11 Solutions .......... Save.. select the first item....... modify the When-Button-Pressed trigger for the CONTROL..........PRODUCT_LOV_BUTTON............... EXECUTE_QUERY........... h In the LOV_PRODUCT form.... The code then deletes the record group......... :GLOBAL........................ .

............ There is no formal solution......... This object group contains a block named S_ORD...... This report displays a customer list using a tabular layout... Display only the ID. A-42 Developer/2000: Build Forms II .... d Select Column as chart type..... Copy the OBJ_CHART object group into the CUSTOMERS form.... Select Use the Chart Wizard from the New Chart Object dialog box...... Name this page CHART and change the label name... c From the Layout Editor.. There is no formal solution.................. and REGION_ID fields............................ There is no formal solution...................... To display the chart.... Only one item from this block is visible: TITLE... Practice 12 Solutions 1 Create a chart object by using the Chart Wizard........... Select Copy.... Do not specify a title for the chart....... From the Chart tab... g Click the Finish button.......... b Create a new tab page on the TAB_CUSTOMER canvas...... f Select CUSTOMER_NAME to appear on the Category (X) axis.... There is no formal solution.............. Save. double-click the icon next to the FORM_BUILDER_II object library node... NAME....... and test your form.........olb object library.... 2 Create a report object based on the S_CUSTOMER block...... Plain as chart subtype.......... In the Object Navigator... run.............. select the OBJ_CHART object group and drag it to the object group node in the CUSTOMERS form.....Appendix A: Practice Solutions ....... Open the FormBuilder_II..... .... There is no formal solution....... This chart should display the total orders for each customer. There is no formal solution....... COUNTRY.... This item displays a title for the chart. click in the Title item on the Chart tab..... a Open the CUSTOMERS form......... a Open the CUSTOMERS form module............ and TOTAL to appear on the Value (Y) axis of the chart....... use the Chart tool to drag a chart area onto the chart tab page............... e Specify the S_ORD block as the data block that contains the data you want to assign to chart columns..........

........Select the ID.............Choose the report style Tabular..........................Practice 12 Solutions ... Change the Query All Record property value to Yes for the S_CUSTOMER block.Click the Create icon... ... e Create a button named CUST_REP_BUTTON into the control block............ Query a customer record before calling the report....... and CREDIT_RATING fields............. .............................Change labels and widths for your fields. h Save. b DECLARE myvar VARCHAR2(50)....Select a template for your report..Click OK....Do not select fields to total....... BEGIN myvar := RUN_REPORT_OBJECT(’my_report’)... ....... and test your form........ Developer/2000: Build Forms II A-43 ............ This will invoke the Report Builder...... d Set the Execution Mode report object property to runtime and the Report Destination Type report object property to screen.................. COUNTRY. g . ............... c Save your report and exit Report Builder.......... Create a new report object......... NAME....... Select Execution Mode and change the value to RUNTIME.. ......Specify a filename of myreport and a block name.... END . ........... Select Report Destination Type and change the value to SCREEN.... ........ ....................... Display this button on the CV_CUSTOMER canvas...... Display the Property Palette for the report object....... f Create a When-Button-Pressed trigger on the CUST_REP_BUTTON button to run the report...Select the Report Object node in the Object Navigator. Within the Report Wizard: ....... run.......................

.................... Organize this block so it is the last block in sequence... 3 Create a new tab page from which the user can run different report layouts............. Do this in the Object Navigator.. select the REPORT block and copy it to the CUSTOMERS form............... double-click the icon next to the FORM_BUILDER_II object library node.............. c Change the filename property to each report so that the path is correct for your environment.......................Appendix A: Practice Solutions . d From the Report tab page....... select all the report objects and copy them to the CUSTOMERS form.. a Open the Form_Builder_II.......................... Do this in the Object Navigator........................ A-44 Developer/2000: Build Forms II ..................... Do this in the Object Navigator........................... f Save........ If you have time.... e From the Report tab page...................... and test your form..... select the REPORT tab page object and copy it to the CUSTOMERS form............. b From the Report tab page..olb object library....................... Organize this tab page so it is the last tab page in sequence................ run............. In the Object Navigator....... .............

Set the Hide on Exit property to Yes for this window.......... v_timer_id := CREATE_TIMER(’ABOUT’. .......user_name’). a When-New-Form-Instance Trigger at Form Level ...... Add the new code after the existing code...........CURRENT_DATETIME..... Create a window named ABOUT.... Set the Window property to ABOUT..cst_show_time.... c Create manually a new control block.. d Show the ”About............. You can import the pr13_1d2.... You can import the pr13_1d1.................................. Set the Modal Property to Yes.......” information at the startup of the form.........txt file for the When-New-Form-Instance trigger......client_date := :SYSTEM... b Add a window and a canvas to the form that are used to display the two control items.............” window for a short period of time at the startup of the form.. Developer/2000: Build Forms II A-45 ....................................... Adjust the canvas size appropriately... Create a canvas named ABOUT... called ABOUT...... Create the text items on the ABOUT canvas and in the ABOUT block. DECLARE cst_show_time CONSTANT NUMBER(4) := 4000.......... Set the Database Item property for both items to No....NO_REPEAT ).. Set the Window Style property to Dialog...... Append the new code to the end of the existing code.. GO_ITEM(’about.... v_timer_id TIMER.. Set both the X Position and Y Position properties to 100......... .... BEGIN :about............................. In the layout editor.. END..... Practice 13 Solutions 1 Show ”About............................... Create two items in the ABOUT block that are used to display the user name and the current date and time. This window could be considered an ”About...txt file for the When-Timer-Expired trigger.Practice 13 Solutions . Create a content canvas named ABOUT................. .. create two text items named user_name and client date.... :about.......user_name := USER....” window and should be a modal dialog window. Open the CUSTOMERS form module......

.......... . create a global variable called GLOBAL..... and create the timer.........locks_pending IS NULL THEN :GLOBAL. timer_id := CREATE_TIMER( ’locks’............................................... END...... END IF... Append the new code to the end of the existing code......................... A-46 Developer/2000: Build Forms II . update the global variable.................................. IF FORM_SUCCESS THEN IF :GLOBAL..... You can import the pr13_2c.... BEGIN LOCK_RECORD...... END IF......txt file.................... DEFAULT_VALUE( NULL.......... When-New-Form-Instance Trigger at Form Level ... ... a Open the CUSTOMERS form module............ 5000 )...id’)...locks_pending := ’TRUE’. END IF.... 2 Automatically ask the users if they want to commit after a set period of 1 time...........Appendix A: Practice Solutions .. ’GLOBAL. which indicates at all times whether rows of the S_CUSTOMER table are locked................ .. On-Lock Trigger at Form Level DECLARE timer_id TIMER....................... ELSE RAISE FORM_TRIGGER_FAILURE.......locks_pending’)........... b At the startup of the form...LOCKS_PENDING.... c Create the On-Lock trigger to implement the default lock processing............ When-Timer-Expired Trigger at Form Level IF GET_APPLICATION_PROPERTY( TIMER_NAME ) = ’ABOUT’ THEN GO_ITEM( ’s_customer..................... If you have time.

. ELSE CLEAR_FORM( no_validate )...................locks_pending IS NOT NULL THEN IF SHOW_ALERT( ’ask_save’ ) = ALERT_BUTTON1 THEN COMMIT_FORM............ Developer/2000: Build Forms II A-47 . Note: You need to create an alert called ASK_SAVE.... Post-Database-Commit Trigger at Form Level :GLOBAL............ END IF.............. Write a When-Timer-Expired trigger to display an alert if locks are still pending after a certain period of time elapses......... END IF..........locks_pending := NULL.... Define an appropriate message........................ d When-Timer-Expired Trigger at Form Level IF GET_APPLICATION_PROPERTY( TIMER_NAME ) = ’ABOUT’' THEN GO_ITEM('s_customer...........Practice 13 Solutions ..... IF :SYSTEM.................id')............................... Define an alert (called ASK_SAVE) of style Caution with a Yes and a No button.............................................You can import the pr13_2e... You can replace the existing code with the code from the pr13_2d. END IF..... ELSIF GET_APPLICATION_PROPERTY( TIMER_NAME ) = ’LOCKS’ THEN IF :GLOBAL......... ........... This alert should ask the user to commit or roll back the changes..FORM_STATUS <> ’CHANGED’ THEN DELETE_TIMER(’locks’)........... e Create the Post-Database-Commit trigger to give the NULL value to the global variable....txt file.............................. END IF.......txt file......................

.......... ............locks_pending := NULL... You can import the pr13_2f....txt file................................ IF FORM_SUCCESS THEN :GLOBAL.............. f Create the On-Rollback trigger to implement the default rollback processing and give the NULL value to the global variable................................................................................................................................... A-48 Developer/2000: Build Forms II ........................Appendix A: Practice Solutions .... On-Rollback Trigger at Form Level ISSUE_ROLLBACK( GET_APPLICATION_PROPERTY( savepoint_name ) ). END IF.........................................................................

Developer/2000: Build Forms II A-49 .... b Run the CUSTOMERS form and try to add a new customer with an existing customer number...........txt file to create the function and the pr14_1e2. and returns a more readable error message....... This form is based on the S_CUSTOMER table......... */ ( p_error_text IN VARCHAR2 ) RETURN VARCHAR2 IS v_start_pos NUMBER(4)........ What FRM-error message do you get? What Oracle server error message do you get? (Select [Display Error] to see the message.... A primary key constraint is declared on the column Id............. Practice 14 Solutions 1 Handle errors caused by declarative constraints violations...........................................) FRM-40508: ORACLE error : unable to INSERT record... Use the function STRIP_CONSTRAINT_NAME to detect which constraint was violated....... Assign the new record an Id of 201 and a name of Dummy........................ c Which trigger must you use to trap error messages caused by violation of this constraint? The On-Error trigger............................................. Open the CUSTOMERS form module... strips away the error number and prefix................... You can import the pr14_1e1....................txt file to replace the existing code in the trigger...... The details of this function are covered in Appendix F......S_CUSTOMER_ID_PK) violated.................... ORA-00001: unique constraint (schema...... ................Practice 14 Solutions ......................... e Trap and replace the default constraint-violation message with your own message..” a FUNCTION strip_constraint_name /* Strips constraint name (without schema prefix) from server-error message... 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 builtin functions...... Note: The function STRIP_CONSTRAINT_NAME accepts a complete server error message........... “Handling Server Side Errors...

.1 ) )........ v_start_pos )....... INSTR( p_error_text...... v_start_pos + 1. BEGIN IF error_type = ’FRM’ AND error_code IN ( 40508...strip_constraint_name /* Get position of dot.... 40509.. v_end_pos -v_ start_pos .. END.......... IF v_start_pos > 0 THEN /* Get position of right parenthesis. ’............. END strip_constraint_name..................... */ v_constraint_name := strip_constraint_name( DBMS_ERROR_TEXT ). IF v_constraint_name = ’S_CUSTOMER_ID_PK’ THEN MESSAGE( ’This customer already exists.. starting from position of left parenthesis............ starting from position of dot. BEGIN -.. A-50 Developer/2000: Build Forms II .. RAISE FORM_TRIGGER_FAILURE........... /* Show default FRM-error message.Appendix A: Practice Solutions .......... END IF.................. */ v_end_pos := INSTR( p_error_text....’....................... END IF..... v_end_pos NUMBER(4)........ ’(’ ) )........ -2292 ) THEN /* PK/UK/FK/CK-constraint violation error.. /* Return constraint name between dot and right parenthesis.............. END IF................ ’)’.................. ......................................... */ MESSAGE( ERROR_TYPE || TO_CHAR( -ERROR_CODE ) || ’: ’ || ERROR_TEXT )... -2291. RAISE FORM_TRIGGER_FAILURE..... */ v_start_pos := INSTR( p_error_text...... On-Error Trigger at Form Level DECLARE v_constraint_name VARCHAR2(255)............. */ RETURN( SUBSTR( p_error_text...............’ )............ END IF.... ELSE RETURN( null ). 40510) THEN IF DBMS_ERROR_CODE in ( -1.. -2290.

...’ ).rowid <> p_rowid OR p_rowid IS NULL ).................. IF c_cust%FOUND THEN CLOSE c_cust.check_pk_cust OPEN c_cust............. cust_exists EXCEPTION.......txt file to create the procedure and the pr14_2b2... f PROCEDURE check_pk_cust ( p_cust_id IN NUMBER .... ELSE CLOSE c_cust........ FETCH c_cust INTO r_cust.............. BEGIN -..... RAISE FORM_TRIGGER_FAILURE....... There is no formal solution............. b Implement immediate primary-key checking in the CUSTOMERS form by creating a procedure called CHECK_PK_CUST.............. Try to insert a duplicate Id value....................... Developer/2000: Build Forms II A-51 ......Practice 14 Solutions ......... r_cust c_cust%ROWTYPE................ 2 Handle errors caused by stored program units......... RAISE cust_exists....... and note the displayed message.......................... p_rowid IN VARCHAR2 ) IS CURSOR c_cust is SELECT 0 FROM s_customer d WHERE d... a Open the CUSTOMERS form module. Save and compile the form...........txt file to replace the existing code in the trigger................ END IF.......id = p_cust_id AND ( d..... EXCEPTION WHEN cust_exists THEN MESSAGE( ’This customer already exists.......... Call this procedure from an appropriate trigger........ END check_pk_cust.. .............. If you have time ........................................... You can import the pr14_2b1.....

..................) FRM-40735: WHEN-VALIDATE-ITEM trigger raised unhandled exception ORA-20000.......... :s_customer............. What error do you get? This customer already exists.... ’This customer already exists... for example: c RAISE_APPLICATION_ERROR( -20000.. Explain the errors that are shown........ Delete the local CHECK_PK_CUST procedure in your form.................... After selecting [Display Error] you get the following message: FRM-42100: No errors encountered recently......... g Which trigger must you use to trap error messages caused by stored procedures? You must trap the error messages in the trigger in which you call the stored procedure.’)......id.........ID Item :global.......... Run the form and try to add a new customer with an existing customer number.. Correct this by replacing the built-in procedure and the built-in exception with a single statement.............customer_id := :s_customer....... f ..................................... The errors are caused because MESSAGE is a built-in procedure and FORM_TRIGGER_FAILURE is a built-in exception to Oracle Forms.......rowid)...Appendix A: Practice Solutions ........ This is the error message specified by the Forms Designer in procedure CHECK_PK_CUST......................... A-52 Developer/2000: Build Forms II . d Drag the CHECK_PK_CUST procedure to the database under your user account.....id........ There is no formal solution......... Enter an Id value of 201 and press [Next Item] to fire the When-Validate-Item trigger.. CHECK_PK_CUST( :s_customer. It is therefore not known in the Oracle server.... It is not an FRM-error message or an Oracle server error...... e Examine the stored procedure CHECK_PK_CUST in the Stored Program Unit editor..................... in this case the When-Validate-Item trigger........................... What FRM-error messages do you get? What Oracle server error message do you get? (Select [Display Error] to see the message.... When-Validate-Item Trigger on the S_CUSTOMER.................... Run the form and try to add a new customer with an existing customer number........ Correct the errors by using RAISE_APPLICATION_ERROR.

.. When-Validate-Item Trigger on the S_CUSTOMER............... ’ORA-’.txt file to create the function and the pr14_2i2..................... END IF.......customer_id := :s_customer..... remove ORA-error in front. IF v_end_pos > 0 THEN /* Return application error message (without ORA-error number) before next ORA-error...... 12 ) )....... 12............2.... */ v_end_pos := INSTR( p_error_text................ without error number............. FUNCTION strip_application_error /* Strips application-error message.......................id.strip_application_error /* Get position of (second) ORA-error.. starting from position 5..... 5 ) ...... Developer/2000: Build Forms II A-53 .........Practice 14 Solutions ............ID Item BEGIN :GLOBAL...... check_pk_cust( :s_customer. v_end_pos .......rowid) ... BEGIN -............ */ RETURN( SUBSTR( p_error_text..... EXCEPTION WHEN OTHERS THEN IF SQLCODE BETWEEN -20999 AND -20000 THEN ........... */ ( p_error_text in varchar2 ) RETURN VARCHAR2 IS v_end_pos NUMBER(4).. else /* Server error only contains application error.........txt file to replace the existing code in the trigger.................. END strip_application_error.... :s_customer........ This is the first error of the full server-error message...............11 ) ).. h i Which built-in functions must you use to get error messages caused by stored procedures? The SQLCODE and SQLERRM functions........... Trap and replace the default error message with your own message.. Use the function STRIP_APPLICATION_ERROR to get the application-error text........... */ RETURN( SUBSTR( p_error_text...id.. from server-error message.......................... You can import the pr14_2i1............

.... /* Application error caused by database trigger or stored program unit... j Save......................................................................................... compile and test the form............................... END IF...................................................Appendix A: Practice Solutions .............................. A-54 Developer/2000: Build Forms II .... END.............................. */ MESSAGE( strip_application_error( SQLERRM ) )..................................... RAISE FORM_TRIGGER_FAILURE............... ..............

.. DECLARE dummy NUMBER.............. (Retrieve the list of products excluding the products that exists in the S_ITEM block................ b Open the Form_Builder_II... names.............. c From the Picklist Basic tab page.. e Attach the picklist............ This picklist enables the end user to make selections from two lists.......Practice 15 Solutions ... Organize the CONTROL block so it is the last block in sequence..) Select the first element in the list by using the SET_PICLIST_SELECTION procedure. BEGIN DEFAULT_VALUE(’’..olb object library.... Do this in the Object Navigator.. and suggested prices from the S_PRODUCT table.......................... ’GLOBAL.... using the POPULATE_PICKLIST_WITH_QUERY function....... The block contains two buttons...........where_cls’).................................. Developer/2000: Build Forms II A-55 ................ Populate the List_in.. do not subclass the object group... and a block........ f Create a When-New-Form-Instance trigger to populate the List_In....txt file............ we have provided most of the code by way of an object library... with the results of a query that returns the IDs................ with the code to return the products selected in the picklist to the orders form.. This object group contains a canvas.... Note: To reuse the code you wrote in practice 10 question 2... Create an instance of the picklist with the CREATE_PICKLIST procedure.... .. drag and copy the PICKLIST_BASIC object group to the Object Groups node in your module and release it. Practice 15 Solutions 1 Create a picklist by using the picklist class.... copy the PICKLIST object group into your new form module.......... a window.............. one showing the products available and the other showing the objects selected..... You can import the pr15_1f..... a Create a new form module...... pick_list........ d From the Picklist Class tab page........... and display both lists by using the DISPLAY_PICKLIST procedure. Copy the object group...pll library to your form..............create_picklist........ This object group contains all the objects to implement the picklist. You should use the global variable from practice 11........

. j date_lov... copy the calendar object group. You can import the pr15_2c.........window x position 60.ok button label ’Cancel’....... 2 In the ORDERS form.date_ordered’. ’SELECT name...display_picklist(pick_list......populate_picklist_with_query(pick_list........list_out)..........................return block.... -................... ... 1. Comment out the old CALL_FORM line. c Create a Key-Listval trigger on the date ordered item. i Modify the When-Button-Pressed trigger for the CONTROL...pll.......Appendix A: Practice Solutions .highlight weekend days FALSE. -......list_in).... h Open the ORDERS form module..... Compile your form..cancel button label TRUE..... ....item 240............autoskip after selection ... to your module... -... -.... NO_HIDE )......window y position ’Order Date’..fmb.. a From the calendar page of the Form_Builder_II.. and test your form......... dummy := pick_list................display_picklist(pick_list.... ....where_cls || ’ ORDER BY 1’)....... Save your form using the filename PickList.DATE_ORDERED item and S_ORD..... id FROM s_product WHERE ’ || :GLOBAL......PRODUCT_LOV_BUTTON so that it calls your new form module. pick_list.. which contains the Date_LOV package... Add code to display the calendar using the Date_LOV package....... it called an LOV from an earlier lab.txt file.DATE_SHIPPED item.get_date( sysdate........ If you have time... -........initial date ’s_ord...... -..olb object library.... run.... -................... A-56 Developer/2000: Build Forms II . END... b Attach the PL/SQL library calendar..autoconfirm selection FALSE)...set_picklist_selection(pick_list.. pick_list....... CALL_FORM(’picklist’. NULL)......... -........ pick_list.list_in.... ...list_in...... . g ........ -.. Save............. -..... add a calendar on the S_ORD..window title ’OK’.....

........ d Create a Key-Listval trigger on the date shipped item......Practice 15 Solutions .. -.................. run...............highlight weekend days FALSE.........................window y position ’Order Date’..... -..................date_shipped’......return block.. -................txt file.....initial date ’s_ord....window x position 60................... -....... and test your form....... Add code to display the calendar using the Date_LOV package...................................... Developer/2000: Build Forms II A-57 . -........ -.............window title ’OK’.................autoskip after selection e Save.. -. .You can import the pr15_2d.......... -.....ok button label ’Cancel’.......autoconfirm selection FALSE)...............cancel button label TRUE......... -...............get_date( sysdate + 7....... -.....item 240...... date_lov........

.................................................................................................... ............................Appendix A: Practice Solutions .................................................................................................................................................... A-58 Developer/2000: Build Forms II .........................

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

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

.............................................................................................................. 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 .....................S_CUSTOMER Description ...................................................................

........................... Japan Poor 14 4 Customer Should Always Pay By Cash Until His Credit Rating Improves.......................... S_CUSTOMER Data SQL> SELECT * FROM s_customer..... B-4 Oracle Developer: Build Forms II ....................................................................................... 202Oj Atheletics 81-20101 Osaka 6741 Takashi Blvd........ .............. IdName ------ Phone ------------------ Address ------------ ----------- City State Country ------------------ ---------------- ----------- Zip_code Credit_ra Sales_rep_id Region_id ---------- --------- ------------ --------- Comments -------------------------------------------------201Unisports 55-2066101 Sao Paolo 72 Via Bahia Brazil Excellent 12 2 Customer Usually Orders Large Amounts And Has A High Order Total............................................................................... 203Delhi Sports 91-10351 New Delhi 11368 Chanakya India Good 14 4 Customer Specializes In Baseball Equipment And Is The Largest Retailer In India.. This Is Okay As Long As The Credit Rating Remains Excellent......................................Appendix B: Table Descriptions and Data ...................

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

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

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

.............................................................. B-8 Oracle Developer: Build Forms II ......................................................... .........--------------------------------10Finance1 31Sales1 32Sales2 33Sales3 34Sales4 35Sales5 41Operations1 42Operations2 43Operations3 44Operations4 45Operations5 50Administration1 12 rows selected................................ S_DEPT Description and Data Column NameNull?Datatype ------------------------------------------------ID NOT NULLNUMBER(7) NAMENOT NULLVARCHAR2(25) REGION_IDNUMBER(7) SQL> SELECT * FROM s_dept...................................... IDNAMEREGION_ID -----.........Appendix B: Table Descriptions and Data ...............................................................................................

................ Oracle Developer: Build Forms II B-9 ...................................................................................... 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) ................S_EMP Description .........................................................................................2) COMMISSION_PCTNUMBER(4......................................

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

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

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

................S_ITEM Description .................................................................... Oracle Developer: Build Forms II B-13 ......................... 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) ..........................................................................................................................

.....................................................----------------100110011135500500 100210013380400400 10031002114500500 100530326582600600 1007410108250250 10063043320450450 10041002336400400 101130421161515 10134101082020 1015501694................................................ ORD_IDITEM_IDPRODUCT_IDPRICEQUANTITYQUANTITY_SHIPPED -------------......81616 105350532472828 105250419801313 ................Appendix B: Table Descriptions and Data ......................................................................----------.................................... S_ITEM Data SQL> SELECT * FROM s_item......-------------.................................294040 101650417802727 101750530455050 101441100453535 101240422503030 10212010828100100 1022202011234545 103130433201515 10323277971111 10412051097 7 104430421163535 10422051281212 10433032116691919 10515027322.............................. B-14 Oracle Developer: Build Forms II .......

..................................................................................... Note: The above display has been formatted....897575 106550418759898 106650419802727 1062202011232121 1063501694.......25500500 109750418754343 109632861605050 10943032658215001500 109210012175600600 10931002221....... S_ITEM Data (continued) ORD_IDITEM_IDPRODUCT_IDPRICEQUANTITYQUANTITY_SHIPPED -------------.....95300300 11015027322......................----------....................................................891717 110250536502323 111140421652727 111241080352929 97120106910001000 9723032115005050 981404218577 9912051091818 9922051282525 99350417805353 99450530456969 112120106115050 62 rows selected..----------------106120108284646 10645027322........ ........................................... Oracle Developer: Build Forms II B-15 ...........-------------................S_ITEM Data .............................................29125125 107120106115050 107320201115130130 107530421165555 10743032116697575 107220108282222 108120510999 108641080355050 108741100454242 108532861605757 10822051281818 10843277976060 10833032116698585 109110011140150150 10953042618..

........................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..................... B-16 Oracle Developer: Build Forms II ...............................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................................Appendix B: Table Descriptions and Data ....................... S_ORD Description and Data Column NameNull?Datatype --------------------------------------------------ID NOT NULLNUMBER(7) CUSTOMER_IDNOT NULL NUMBER(7) DATE_ORDEREDDATE DATE_SHIPPEDDATE SALES_REP_IDNUMBER(7) TOTAL NUMBER(11............ ............------------------------------------------------------------100 204 31-AUG9210-SEP-9211601100CREDITY 101 205 31-AUG-9215-SEP-92148056... ID CUSTOMER_IDDATE_ORDEDATE_SHIPSALES_REP_IDTOTALPAYMENORDER_F --.................................................................................2) PAYMENT_TYPEVARCHAR2(6) ORDER_FILLEDVARCHAR2(1) SQL> SELECT * FROM s_ord................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...................................................

....... 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.............................................................................S_PRODUCT Description ..................................................................................2) WHLSL_UNITSVARCHAR2(25) ................................................................................................................ Oracle Developer: Build Forms II B-17 ......................

.............Appendix B: Table Descriptions and Data .................................................. ID NAMESHORT_DESCLONGTEXT_ID ----------------------------------------IMAGE_IDSUGGESTED_WHLSL_PRICEWHLSL_UNITS ---------------------------------------10011BootBeginner’s ski boot518 1001150 10012Ace Ski BootIntermediate ski boot519 1002200 10013Pro Ski BootAdvanced ski boot520 1003410 10021Bunny Ski PoleBeginner’s ski pole528 101116............................95 10023Pro Ski PoleAdvanced ski pole530 101340............................................... S_PRODUCT Data SQL> SELECT * FROM s_product.95 20106Junior Soccer BallJunior soccer ball613 11 20108World Cup Soccer BallWorld cup soccer ball615 28 20201World Cup NetWorld cup net708 123 ........................................................................................................................................ B-18 Oracle Developer: Build Forms II ...........................25 10022Ace Ski PoleIntermediate ski pole529 101221.

S_PRODUCT Data
.....................................................................................................................................................

S_PRODUCT Data (continued)
ID NAMESHORT_DESCLONGTEXT_ID
------------------------------------------IMAGE_IDSUGGESTED_WHLSL_PRICEWHLSL_UNITS
---------------------------------------20510Black Hawk Knee pads, pair1017
Knee Pads9
20512Black Hawk Elbow pads, pair1019
Elbow Pads8
30321Grand Prix Bicycle Road bicycle828
12911669
30326Himalaya BicycleMountain bicycle833
1296582
30421Grand PrixRoad bicycle tires927
Bicycle Tires16
30426Himalaya TiresMountain bicycle tires933
18.25
30433New Air PumpTire pump940
20
32779Slaker Water Water bottle1286
Bottle7
32861Safe-T HelmetBicycle helmet1368
1829 60
40421Alexeyer ProStraight bar928
Lifting Bar
138165
40422Pro Curling BarCurling bar929
138250

.....................................................................................................................................................
Oracle Developer: Build Forms II
B-19

Appendix B: Table Descriptions and Data
.....................................................................................................................................................

S_PRODUCT Data (continued)
ID NAMESHORT_DESCLONGTEXT_ID
------------------------------------------IMAGE_IDSUGGESTED_WHLSL_PRICEWHLSL_UNITS
---------------------------------------40421Alexeyer ProStraight bar928
Lifting Bar
138165
40422Pro Curling BarCurling bar929
138250
41010Prostar 10 Ten pound weight517
Pound Weight
8
41020Prostar 20Twenty pound weight527
Pound Weight
12
41050Prostar 50 Fifty pound weight557
Pound Weight
25
41080Prostar 80 Eighty pound weight587
Pound Weight
35
41100Prostar 100
One hundred pound 607
Pound Weightweight
45
50169Major League Baseball676
Baseball
11194.29

.....................................................................................................................................................
B-20
Oracle Developer: Build Forms II

S_PRODUCT Data
.....................................................................................................................................................

S_PRODUCT Data (continued)
ID NAMESHORT_DESCLONGTEXT_ID
--------------------------------------------IMAGE_IDSUGGESTED_WHLSL_PRICEWHLSL_UNITS
---------------------------------------50273Chapman HelmetBatting helmet780
122322.89
50417Griffey GloveOutfielder’s glove924
1367
80
50418Alomar GloveInfielder’s glove925
1368
75
50419Steinbach GloveCatcher’s glove926
1369
80
50530Cabrera BatThirty inch bat1037
1480
45
50532Puckett BatThirty-two inch bat1039
1482
47
50536Winfield BatThirty-six inch bat1043
1486
50
33 rows selected.

Note: The above display has been formatted.

.....................................................................................................................................................
Oracle Developer: Build Forms II
B-21

Appendix B: Table Descriptions and Data
.....................................................................................................................................................

S_REGION Description and Data
Column NameNull?Datatype
---------------------------------------------ID NOT NULLNUMBER(7)
NAMENOT NULLVARCHAR2(50)

SQL> SELECT * FROM s_region;
IDNAME
---------------------------1North America
2South America
3Africa / Middle East
4Asia
5Europe

.....................................................................................................................................................
B-22
Oracle Developer: Build Forms II

S_TITLE Description and Data
.....................................................................................................................................................

S_TITLE Description and Data
Column NameNull?Datatype
-------------------------------------------------TITLENOT NULLVARCHAR2(25)

SQL> SELECT * FROM s_title;
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

.........................................................................................................2) dept_type ------------------------------------------------ID NUMBER NAME VARCHAR2(25) REGION_ID NUMBER(7) ..................................................................................Appendix B: Table Descriptions and Data ..................................2) COMMISSION_PCT NUMBER(4................2) 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.... B-24 Oracle Developer: Build Forms II ................. tables emp_type_ObjCol Name Null? Type ------------------------------------------------ID NUMBER(7) LAST_NAME VARCHAR2(25) FIRST_NAME VARCHAR2(25) USERID VARCHAR2(8) START_DATE DATE MANAGER_ID NUMBER(7) TITLE VARCHAR2(25) DEPT_ID DEPT_TYPE SALARY NUMBER(11........................ Oracle8 objects: types...........2) COMMISSION_PCT NUMBER(4...........

...............---------.Oracle8 objects: types........ tables ............ 1) 1400 . 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... Oracle Developer: Build Forms II B-25 ...2) ID LAST_NAMEFIRST_NAME USERID --------...........................................................--------------------- --------------......... REGION_ID) ----------------------------------------------------------SALARY COMMISSION_PCT ---------............. 1) 2500 2NgaoLaDorislngao 08-MAR-901 VP Operations DEPT_TYPE(41.... ’Operations’....................................-------- START_DAT MANAGER_ID TITLE --------................. ’Administration’..... NAME............................................................... ’Sales’... 1) 1450 3NagayamaMidorimnagayam 17-JUN-91 1 VP Sales DEPT_TYPE(31................2) COMMISSION_PCT NUMBER(4.......------------------------DEPT_ID(ID....-------------1VelasquezCarmencvelasqu 03-MAR-90President DEPT_TYPE(50....................................

............ NAME............... 4) 1300 ...--------------------------------....................... 1) 1550 6 Urguhart Mollymurguhar 18-JAN-91 2 Warehouse Manager DEPT_TYPE(41............-------------4 Quick-To-See Markmquickto 07-APR-901 VP Finance DEPT_TYPE(10.......... ’Finance’.---------. ID LAST_NAMEFIRST_NAMEUSERID ---------...... ’Operations’........ 1) 1450 5RopeburnAudryaropebur 04-MAR-901 VP Administration DEPT_TYPE(50... ’Operations’............. B-26 Oracle Developer: Build Forms II ..........-------START_DAT MANAGER_ID TITLE --------...------------------------DEPT_ID(ID............ 3) 1100 9 CatchpoleAntoinetteacatchpo 09-FEB-922 Warehouse Manager DEPT_TYPE(44............ ’Operations’.......................................... REGION_ID) -----------------------------------------------------------SALARY COMMISSION_PCT ---------................. 2) 1250 8 Biri Benbbiri 07-APR-902 Warehouse Manager DEPT_TYPE(43. ’Administration’...Appendix B: Table Descriptions and Data ....................... ’Operations’..................................... 1) 1200 7 MenchuRobertarmenchu 14-MAY-90 2 Warehouse Manager DEPT_TYPE(42...................................................

........ tables ............ ID LAST_NAMEFIRST_NAMEUSERID ---------............ ’Sales’...---------..... NAME......Oracle8 objects: types............... 4) 1525 15 15 DumasAndreadumas 09-OCT-913 Sales Representative DEPT_TYPE(35...........--------------------------------.......... 5) 145018 ..... Oracle Developer: Build Forms II B-27 .. ’Sales’.......... ’Sales’.................................... 5) 1307 11 MageeColincmagee 14-MAY-903 Sales Representative DEPT_TYPE(31............................... ’Sales’............ ’Operations’.......................................... 2) 149013 13 SedeghiYasminysedeghi 18-FEB-913 Sales Representative DEPT_TYPE(33......-------------10 HavelMartamhavel 27-FEB-912 Warehouse Manager DEPT_TYPE(45.......... ’Sales’................................. REGION_ID) -----------------------------------------------------------SALARY COMMISSION_PCT ---------.............. 3) 1515 10 14 NguyenMaimnguyen 22-JAN-923 Sales Representative DEPT_TYPE(34..... 1) 140010 12 GiljumHenryhgiljum 18-JAN-92 3 Sales Representative DEPT_TYPE(32.-------START_DAT MANAGER_ID TITLE --------..............------------------------DEPT_ID(ID................

........................ REGION_ID) -----------------------------------------------------------SALARY COMMISSION_PCT ---------...........------------------------DEPT_ID(ID................. ’Operations’..........Appendix B: Table Descriptions and Data ........... ’Operations’........... B-28 Oracle Developer: Build Forms II ...---------.. 2) 795 20 NewmanChadcnewman 21-JUL-918 Stock Clerk DEPT_TYPE(43.--------------------------------... 3) 850 .....-------START_DAT MANAGER_ID TITLE --------. ’Operations’......... ’Operations’....................................... 3) 750 21 MarkarianAlexanderamarkari 26-MAY-91 8 Stock Clerk DEPT_TYPE(43.............................. ’Operations’.............................. ’Operations’................................... 1) 1400 17SmithGeorgegsmith 08-MAR-906 Stock Clerk DEPT_TYPE(41................................-------------16 MaduroElenaemaduro 07-FEB-926 Stock Clerk DEPT_TYPE(41....... 1) 940 18 NozakiAkiraanozaki 09-FEB-91 7 Stock Clerk DEPT_TYPE(42............................... ID LAST_NAMEFIRST_NAMEUSERID ---------. NAME.... 2) 1200 19PatelVikramvpatel 06-AUG-91 7 Stock Clerk DEPT_TYPE(42.

....................Oracle8 objects: types. 5) 860 25 SchwartzSylviesschwart 09-MAY-9110 Stock Clerk DEPT_TYPE(45........................... ID LAST_NAMEFIRST_NAMEUSERID ---------.......2) COMMISSION_PCTNUMBER(4..... ’Operations’.................................... ’Operations’........... tables .............-------------22 ChangEddieechang 30-NOV-90 9 Stock Clerk DEPT_TYPE(44....................... 4) 795 24 Dancs Belabdancs 17-MAR-9110 Stock Clerk DEPT_TYPE(45......... Oracle Developer: Build Forms II B-29 ........... REGION_ID) -----------------------------------------------------------SALARY COMMISSION_PCT ---------........... 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) .......................... 4) 800 23 PatelRadharpatel 17-OCT-909 Stock Clerk DEPT_TYPE(34...---------...................------------------------DEPT_ID(ID.............. ’Operations’........ ’Sales’.................-------START_DAT MANAGER_ID TITLE --------........................................--------------------------------.. NAME.......

.... B-30 Oracle Developer: Build Forms II .............................------------------------DEPT_ID(ID.............................................................---------................................. NAME............................................-------START_DAT MANAGER_ID TITLE --------...............................................-------------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 ..................Appendix B: Table Descriptions and Data .......... ID LAST_NAMEFIRST_NAMEUSERID ---------........--------------------------------................................. REGION_ID) -----------------------------------------------------------SALARY COMMISSION_PCT ---------...................

............-------START_DAT MANAGER_ID TITLE --------....------------------------DEPT_ID(ID............. NAME........ tables .................. REGION_ID) -----------------------------------------------------------SALARY COMMISSION_PCT ---------............................................ ID LAST_NAMEFIRST_NAMEUSERID ---------................................-------------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 .......................................................................Oracle8 objects: types.......... Oracle Developer: Build Forms II B-31 ...................................................--------------------------------...............---------.............................

..........................Appendix B: Table Descriptions and Data .......-------------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 .......................................................................--------------------------------............................................------------------------DEPT_ID(ID.......... ID LAST_NAMEFIRST_NAMEUSERID ---------................................. NAME................---------............... REGION_ID) -----------------------------------------------------------SALARY COMMISSION_PCT ---------.......... B-32 Oracle Developer: Build Forms II ........-------START_DAT MANAGER_ID TITLE --------..................................................................

..............------------------------DEPT_ID(ID.................................................................. tables ....Oracle8 objects: types.. Oracle Developer: Build Forms II B-33 ........................-------------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 ........................... ID LAST_NAMEFIRST_NAMEUSERID ---------.... NAME..............................................................--------------------------------................................................ REGION_ID) -----------------------------------------------------------SALARY COMMISSION_PCT ---------......-------START_DAT MANAGER_ID TITLE --------.......................---------...........................

........---------...... NAME............................................................ REGION_ID) -----------------------------------------------------------SALARY COMMISSION_PCT ---------........ ID LAST_NAMEFIRST_NAMEUSERID ---------.........------------------------DEPT_ID(ID..............-------------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 .......--------------------------------................................................................Appendix B: Table Descriptions and Data ............. B-34 Oracle Developer: Build Forms II ................................................................................................................-------START_DAT MANAGER_ID TITLE --------.....

.......2) COMMISSION_PCT NUMBER(4..........Oracle8 objects: types.................. 1) 1400 ..... 1) 2500 2 NgaoLaDorislngao 08-MAR-90 1 VP Operations DEPT_TYPE(41........................................ tables ................ 1) 1450 3 NagayamaMidorimnagayam 17-JUN-91 1 VP Sales DEPT_TYPE(31..... ’Operations’......---------..... REGION_ID) -----------------------------------------------------------SALARY COMMISSION_PCT ---------...................2) ID LAST_NAMEFIRST_NAMEUSERID ---------.................... NAME.........................................................-------START_DAT MANAGER_ID TITLE --------..................... ’Sales’.............................................. Oracle Developer: Build Forms II B-35 ..------------------------DEPT_ID(ID....... ’Administration’....-------------1 VelasquezCarmencvelasqu 03-MAR-90President DEPT_TYPE(50.. 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) 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..................... 4) 1300 ..... REGION_ID) -----------------------------------------------------------SALARY COMMISSION_PCT ---------..-------------4 Quick-To-SeeMarkmquickto 07-APR-90 1 VP Finance DEPT_TYPE(10......... ’Finance’........... ’Operations’.............--------------------------------.................. ’Operations’.. NAME...... 1) 1200 7 Menchu Robertarmenchu 14-MAY-90 2 Warehouse Manager DEPT_TYPE(42...................-------START_DAT MANAGER_ID TITLE --------.....---------................ ID LAST_NAMEFIRST_NAMEUSERID ---------........................... 1) 1450 5 RopeburnAudryaropebur 04-MAR-90 1 VP Administration DEPT_TYPE(50.------------------------DEPT_ID(ID.................................Appendix B: Table Descriptions and Data .............. ’Operations’.................. 1) 1550 6 Urguhart Mollymurguhar 18-JAN-91 2 Warehouse Manager DEPT_TYPE(41.... ’Administration’.......................... 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

13 Sedeghi Yasmin ysedeghi
18-FEB-91

3 Sales Representative

DEPT_TYPE(33, ’Sales’, 3)
1515

10

14 NguyenMaimnguyen
22-JAN-92

3 Sales Representative

DEPT_TYPE(34, ’Sales’, 4)
1525

15

15 Dumas
09-OCT-91

Andre adumas
3 Sales Representative

DEPT_TYPE(35, ’Sales’, 5)
1450

18

.....................................................................................................................................................
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
17 Smith George gsmith
08-MAR-90

6 Stock Clerk

DEPT_TYPE(41, ’Operations’, 1)
940
18 Nozaki Akira anozaki
09-FEB-91 7 Stock Clerk
DEPT_TYPE(42, ’Operations’, 2)
1200
19 PatelVikramvpatel
06-AUG-91 7 Stock Clerk
DEPT_TYPE(42, ’Operations’, 2)
795
20 Newman Chad cnewman
21-JUL-91

8 Stock Clerk

DEPT_TYPE(43, ’Operations’, 3)
750
21 Markarian
26-MAY-91

Alexanderamarkari

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
23 Patel Radha rpatel
17-OCT-90

9 Stock Clerk

DEPT_TYPE(34, ’Sales’, 4)
795
24 Dancs Bela bdancs
17-MAR-91

10 Stock Clerk

DEPT_TYPE(45, ’Operations’, 5)
860
25 Schwartz Sylvie sschwart
09-MAY-91

10 Stock Clerk

DEPT_TYPE(45, ’Operations’, 5)
1100

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
2 Ngao LaDoris lngao
08-MAR-90 1 VP Operations
0000220208447F54A9ED5F676AE03408002072C15B447F54A9ED55676AE0340800
2072C15B
1450
3 Nagayama Midori mnagayam
17-JUN-91 1 VP Sales
0000220208447F54A9ED5A676AE03408002072C15B447F54A9ED55676AE0340800
2072C15B
1400
4 Quick-To-See Mark mquickto
07-APR-90 1 VP Finance
0000220208447F54A9ED59676AE03408002072C15B447F54A9ED55676AE0340800
2072C15B
1450
5 Ropeburn Audry aropebur
04-MAR-90 1 VP Administration
0000220208447F54A9ED64676AE03408002072C15B447F54A9ED55676AE0340800
2072C15B
1550

.....................................................................................................................................................
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
9 Catchpole Antoinette acatchpo
09-FEB-92 2 Warehouse Manager
0000220208447F54A9ED62676AE03408002072C15B447F54A9ED55676AE0340800
2072C15B
1300
10 Havel Marta mhavel
27-FEB-91 2 Warehouse Manager
0000220208447F54A9ED63676AE03408002072C15B447F54A9ED55676AE0340800
2072C15B
1307
11 Magee Colin cmagee
14-MAY-90 3 Sales Representative
0000220208447F54A9ED5A676AE03408002072C15B447F54A9ED55676AE0340800
2072C15B
1400

10

13 Sedeghi Yasmin ysedeghi
18-FEB-91 3 Sales Representative
0000220208447F54A9ED5C676AE03408002072C15B447F54A9ED55676AE0340800
2072C15B
1515

10

.....................................................................................................................................................
Oracle Developer: Build Forms II
B-41

..........................................................--------------------------------...............Appendix B: Table Descriptions and Data . NAME.............................................................-------------14 Nguyen Mai mnguyen 22-JAN-92 3 Sales Representative 0000220208447F54A9ED5D676AE03408002072C15B447F54A9ED55676AE0340800 2072C15B 1525 15 15 Dumas Andre adumas 09-OCT-91 3 Sales Representative 0000220208447F54A9ED5E676AE03408002072C15B447F54A9ED55676AE0340800 2072C15B 1450 18 16 Maduro Elena emaduro 07-FEB-92 6 Stock Clerk 0000220208447F54A9ED5F676AE03408002072C15B447F54A9ED55676AE0340800 2072C15B 1400 17 Smith George gsmith 08-MAR-90 6 Stock Clerk 0000220208447F54A9ED5F676AE03408002072C15B447F54A9ED55676AE0340800 2072C15B 940 18 Nozaki Akira anozaki 09-FEB-91 7 Stock Clerk 0000220208447F54A9ED60676AE03408002072C15B447F54A9ED55676AE0340800 2072C15B 1200 ............................................... ID LAST_NAMEFIRST_NAMEUSERID ---------... REGION_ID) -----------------------------------------------------------SALARY COMMISSION_PCT ---------...........------------------------DEPT_ID(ID....-------START_DAT MANAGER_ID TITLE --------............... B-42 Oracle Developer: Build Forms II ................................................................---------...........................

........ Oracle Developer: Build Forms II B-43 ......------------------------DEPT_ID(ID................---------.......Oracle8 objects: types..................................... tables .........................................................................-------------19 Patel Vikram vpatel 06-AUG-91 7 Stock Clerk 0000220208447F54A9ED60676AE03408002072C15B447F54A9ED55676AE0340800 2072C15B 795 20 Newman Chad cnewman 21-JUL-91 8 Stock Clerk 0000220208447F54A9ED61676AE03408002072C15B447F54A9ED55676AE0340800 2072C15B 750 21 Markarian Alexander amarkari 26-MAY-91 8 Stock Clerk 0000220208447F54A9ED61676AE03408002072C15B447F54A9ED55676AE0340800 2072C15B 850 22 Chang Eddie echang 30-NOV-90 9 Stock Clerk 0000220208447F54A9ED62676AE03408002072C15B447F54A9ED55676AE0340800 2072C15B 800 23 Patel Radha rpatel 17-OCT-90 9 Stock Clerk 0000220208447F54A9ED5D676AE03408002072C15B447F54A9ED55676AE0340800 2072C15B 795 ....... REGION_ID) -----------------------------------------------------------SALARY COMMISSION_PCT ---------...................-------START_DAT MANAGER_ID TITLE --------..... NAME.--------------------------------............................................................................................................................... ID LAST_NAMEFIRST_NAMEUSERID ---------.

.........................---------....................................................... NAME......................................................... REGION_ID) -----------------------------------------------------------SALARY COMMISSION_PCT ---------.....................................-------START_DAT MANAGER_ID TITLE --------......------------------------DEPT_ID(ID.--------------------------------................-------------24 Dancs Bela bdancs 17-MAR-91 10 Stock Clerk 0000220208447F54A9ED63676AE03408002072C15B447F54A9ED55676AE0340800 2072C15B 860 25 Schwartz Sylvie sschwart 09-MAY-91 10 Stock Clerk 0000220208447F54A9ED63676AE03408002072C15B447F54A9ED55676AE0340800 2072C15B 1100 ..................................... ID LAST_NAMEFIRST_NAMEUSERID ---------..........Appendix B: Table Descriptions and Data ................................. B-44 Oracle Developer: Build Forms II .............................

................C . Project Builder Addendum ................

........ Objectives • Customize Project Builder – Create module types – Create actions – Create macros – Customize the launcher • Describe inheritance in Project Builder Copyright  Oracle Corporation............................................................................................................................ All rights reserved............................................................... ......................................... Objectives After completing this addendum... C-2 Oracle Developer: Build Forms II ..Appendix C: Project Builder Addendum . 1999.................... 1999.......................... All rights reserved............... 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 Copyright  Oracle Corporation...

...................... ......... This appendix explains how to use Oracle Developer Project Builder in a team environment.......................Introduction .................................................... you should be able to do the following: • Team development with Project Builder.................. • Customize the Project Builder environment............. Objectives After completing this appendix............. The appendix also explains how to customize Oracle Developer Project Builder to the specific requirements of your team................. – Import/Export projects....................................... so that many developers can be working together on the many files that make up a project.................... – Create module types – Create actopms – Create macros – Add tools to the toolbar • Describe inheritance in Project Builder...... – Print and distribute project reports............... and how inheritance can be used to simplify customization.................................... Oracle Developer: Build Forms II C-3 .... – Provide a Global Registry of common types........... Introduction Overview You have already seen how to use Project Builder.............

...... If a developer attempts to change a project........................... Project Builder first checks whether the project has changed since it was last read. and rereads the latest version of the project......... C-4 Oracle Developer: Build Forms II .................. Team Development with Project Builder Team members Project administrator Copyright  Oracle Corporation..................... Project Builder notifies the developer that the changes cannot be saved.................................... 1999........................... Technical Note In some cases............ thus avoiding “last write wins” problems....................... if it has changed.Appendix C: Project Builder Addendum .... The developer can then attempt to make the changes again.......... All rights reserved.................. Project Builder never overwrites one developer’s changes with another’s....................... adding an entry for example......... the project administrator may decide to share a project and allow more than one user to update it......................... ...........................................

..... ........... The project administrator maintains the Global Registry and modifies it as necessary............................................................ Oracle Developer: Build Forms II C-5 ................... if one developer modifies a library that another depends on......................... you can use Project Builder’s dependency management to track that dependency............ exporting the changes to the developers on the team.............................. Team Development with Project Builder In a team environment.....................................................Team Development with Project Builder ...... The Project Administrator A project administrator is charged with creating projects and making them available to developers or team members............................................................ just as it would for a single user.........................

....upd. The Role of the Global Registry • Shared by all developers • Placed on a shared network drive • Modified by the project administrator • Saved to ORACLE_HOME\PJ60\typesnn............................. 1999..... ... C-6 Oracle Developer: Build Forms II ......................................................................Appendix C: Project Builder Addendum .................... The Role of the User Registry • Private to each user • Placed on a local drive or on a network drive • Used to add private types • Used to override the definitions of types in the Global Registry Copyright  Oracle Corporation............................................................... where nn indicates the national language Copyright  Oracle Corporation.................................................. All rights reserved............................................... All rights reserved.......... 1999.....

...... Because this registry is shared by the whole team....... The Role of the Global Registry Commonly..... Oracle Developer: Build Forms II C-7 ........ It contains the type definitions that are shared across the team.... or overwriting the registry file....... although the whole team can read this file... The Role of the User Registry As its name suggests.................... and it is normally placed either on a local drive on each user’s PC or on a private directory on a network drive... such as a user’s inadvertently moving................. the Global Registry is shared by all developers.... (Under UNIX it is placed under the user’s home directory)...........................Team Development with Project Builder .. To make it accessible to everybody. The Global Registry file name is typesnn.................................. to avoid conflicting changes only the project administrator should make changes to it... they can edit it freely............... ....................... the project administrator may place the Global Registry on a shared network drive.. deleting..................... only the project administrator can modify it...upd where nn indicates the national language................ Protecting the Global Registry in this way also prevents accidental damage.. The recommended way to ensure this is to use the network file system’s file permissions and access control to ensure that.... By default.............. This file may be globally writable on your platform by default...... Because all users have their own User Registry...................... the User Registry is private to each individual user............... this file is installed to ORACLE_HOME\PJ60........................... for example to add private types or to override the definitions of types in the Global Registry....

.Appendix C: Project Builder Addendum .............................................................................................................. Copyright  Oracle Corporation........................................... C-8 Oracle Developer: Build Forms II .... 1999... 2...upd............................. The project is saved to ORACLE_HOME\PJ60\pjusernn.............................................. Importing and Exporting Projects 1.................... ...... Enter details............ where nn indicates the national language................. Select File—>Export or Import Project......... All rights reserved......

3 Click the Export button.. the simplest approach is to place the project file on a file server....................... or developers may share a single copy on a shared network drive................................................. where nn indicates the national language.. If a project is shared............. the project administrator may decide to provide each developer with a private copy of the project file..... The best choice depends on whether every or only one developer is allowed to modify the project..........upd........... and protect the file against update in the same way that the Global Registry is protected...... How to Export Projects 1 Select File—>Export Project..... Projects may be private to an individual developer or shared among several developers.. 2 Enter Details.. The user’s individual changes can then be shared by using Project Builder’s export and import commands............................... If only one developer is allowed to modify a particular project........ If more than one user is allowed to modify a project...........................Team Development with Project Builder . Oracle Developer: Build Forms II C-9 .......... the recommended way to share these changes is for the project administrator to provide each user with a private copy of the project............ The project is exported to a file named ORACLE_HOME\PJ60\pjusernn................................................................................................ . Importing and Exporting Projects Projects are each stored each in their own project file.

..........................Appendix C: Project Builder Addendum .................................................................................. Generating and Printing Project Reports Copyright  Oracle Corporation......................... All rights reserved..................................... C-10 Oracle Developer: Build Forms II .................... 1999................................................... .............................................................

....................................... you can automatically print project reports showing information about the projects under development............ and information about the tools included in the launcher............................. Generating and Printing Project Reports With Project Builder............... Choose File—>Print Project Info........................................ Project information can include information about types you have defined.. This displays the Print Project Info dialog box................. ......... as well as actions and macros that work on them..........................................................................................Generating and Printing Project Reports ...................... You may also restrict the information displayed in a report by selecting a filter.... Oracle Developer: Build Forms II C-11 ............................

...... Defining New Module Types Copyright  Oracle Corporation.................. 2 Delete the ICO File type..................................... 6 From the lab directory.......... select the abort... 1999......................................... 3 Select File––>New––>Type........... Instructor Note Demonstration: 1 Expand the User Registry................ 7 Choose an appropriate icon to represent the new ICO File type......... ..... C-12 Oracle Developer: Build Forms II ......... 5 Click the “Choose file for model ...............Appendix C: Project Builder Addendum ..................... All rights reserved.............................................................” button............................. 4 Explain the wizard and the properties..............ico file.........

....................... and select Tools––>Module Type Wizard.......... clear the check box..................... For example... you may use a specific type of graphics editor whose file format is not predefined.. The Module Type Wizard welcome screen appears...... To avoid seeing the welcome screen each time the wizard is invoked........................ Click the Next button to continue................................................................................. select File––>New––>Type...... However.......... Defining New Module Types Most common file types are predefined in Project Builder................. your application may need file types........... You can also use the Module Type Wizard to edit existing module types................... or “module types... To define a new file type.....” that are not predefined......... Oracle Developer: Build Forms II C-13 ........ ........................... Simply highlight the module type name in the Project Navigator............................ Procedure Builder can be expanded to support the new module type..Defining New Module Types .

................ . Instructor Note Demonstration: 1 Expand the User Registry.................................. 3 Select File––>New––>Type...................... 4 Explain the wizard and the properties..........Appendix C: Project Builder Addendum ......................... C-14 Oracle Developer: Build Forms II .... 1999...................................” button........ All rights reserved........ 7 Choose an appropriate icon to represent the new ICO File type. 6 From the lab directory..................................................... 2 Delete the ICO File type.......ico file......... select the abort.................... 5 Click the “Choose file for model ..................... Identifying New Module Types Copyright  Oracle Corporation........................................

.............Identifying New Module Types ........................ click “Choose file for model” and select the file from the Derive Type dialog box..................................................................................................... Enter a description for the type in the Description field........ or the User Registry option button if you alone require access to the new type.......... this is simply the file’s unique extension (for example...... In most cases.................... the Module Type Wizard populates several fields throughout the wizard with the appropriate information. Based on the file you select... The name you enter appears under the Global Types or User Types node......................... Oracle Developer: Build Forms II C-15 ..... Identifying New Module Types The next panel of the Module Type Wizard enables you to choose a name and location for the new module type.............. Enter an internal name for the type in the Internal Name field........................ Select the Global Registry option button if you want the type to be accessible to all users............. Click the Next button to continue.. FM for FrameMaker files)....................... ............... If you have access to a file of the new type......

................................................................ C-16 Oracle Developer: Build Forms II ........................................... 1999............................ ................................................. All rights reserved.............................................. Describing New Module Types Copyright  Oracle Corporation.........................................................Appendix C: Project Builder Addendum ...............

............. Note: Macros are introduced later in this appendix..... In the Filename format box... You may have to finish defining this type.............. make sure the target type has been defined............ select the target type from the “Build files of this type into” drop-down list... In the Options box......... Click the Next button to continue............. Describing New Module Types The next panel of the Module Type Wizard enables you to define the format and content of the new module type........... select the option button that describes the content of the file: Binary (for executables)........ • Click “Deliver files of this type” to automatically set the Deliver File property to Yes for all files of this type.. d...... ..... database tables..... If you don’t see the file you want......................... A pattern is any literal string. Oracle Developer: Build Forms II C-17 . f.... select the check boxes that describe other attributes for the type: • Click “Version control files of this type” to automatically set the Version Control file property to Yes for all files of this type.... then go back to the original type and select the target type from this drop-down list. This also enables the Check In/Check Out actions under File––>Administration. Textual (for nonexecutables)......Describing New Module Types ............................fmb files become ................................. or combination of a literal string and one of the following built-in macros: b...................... In the File content box..fmx files)........... • If files of this type become another type as a result of the Build action (as ........ or Non-file (for URLs........ or n................................ or other entities not managed as files)...... define the target type.... select the option button that describes how you want Project Builder to recognize this type of file: by extension (enter the file extension) or by pattern......................

.................................. 1999............................................................... All rights reserved.........................................................................................Appendix C: Project Builder Addendum ..................... Actions for New Object Types Copyright  Oracle Corporation............................. ............................... C-18 Oracle Developer: Build Forms II ...................................

.................. Note: Later in this appendix.... • To make an action the type’s default.. contains the icons for the actions: inherited. • To remove an action from the type definition... and default............ Actions for New Module Types Use this panel to define and modify the actions associated with this type.............. This is the action that is invoked when you double-click an item of this type on the Project Navigator. If desired............................. or Default headers to sort the list by these respective columns..... Oracle Developer: Build Forms II C-19 ..... select the action and click Make Default. select the action and click Edit...... • To add an action to the type............ The New Action dialog box is displayed........... overridden. The Edit Action dialog box is displayed...... • To change an action’s name......... You can also resize the columns by placing the cursor on a column until the arrow appears and dragging the arrows to increase or decrease the size................ click Add...... The action also appears at the top of the right-click menu for all items of this type....... click on the Name... Description...... Click the Next button to continue...Actions for New Module Types ..... .................................... or default setting..... The first column.................................................................... you will learn how to create and edit actions...... select the action and click Remove.............. description.. which is unlabeled..........

........................................................... ............................................. 1999................................................................... C-20 Oracle Developer: Build Forms II ....................................... An Icon for New Object Types Copyright  Oracle Corporation.............................Appendix C: Project Builder Addendum .......................................... All rights reserved.....................

.......................................................... click the icon that you want to associate with this type..................... an alert is displayed.... Making sure that the From file check box is cleared... If you selected “Choose file for model” on the second panel of this wizard...... An Icon for New Module Types The last panel of the Module Type Wizard enables you to select an icon to represent your type by using one of these methods: • Select the From File check box............................. • If you do not have access to a file with an appropriate icon........An Icon for New Module Types ................. Click Finish to complete your creation or modification of this type.............................. you can choose one from the list of predefined icons............................ then use the Browse button to select a file............... If you choose a file that does not have an associated icon............ the appropriate icon should be selected for you.... both of which usually have icons associated with them... ................................ try to choose an executable or library file.... Oracle Developer: Build Forms II C-21 ............... If you need to select a file........................

..................... Modifying Types Using Actions • Actions can be defined for a type...... unless that object is a project or subproject. You can also delete this action and re-create it.... All rights reserved...... the action applies only to that object.................................... ....... • Action definitions often use macros.................... 2 Select the SQL File type.............................. 1999...... 3 Select the Run Script action and edit this action............. C-22 Oracle Developer: Build Forms II ............. and edit the properties.................. or components through the Property Palette.. project..... Then the action applies to the child objects of the project if the action affects the type of the child objects........................................................... all objects of that type that reference the user registry inherit the new action. If you add an action to an object....... Instructor Note Demonstration: 1 Expand the User Registry... Copyright  Oracle Corporation...... Technical Note If you add an action to a type in the user registry.......................................... 4 Explain the properties...Appendix C: Project Builder Addendum .........

or the source control actions) and remains grayed out for other types of actions........ Modifying Types Using Actions You can change or add new actions: 1 In the Project Navigator..... However...... The input item you select either replaces any selected text in the Action Definition text box or is inserted at the cursor position...... use two ampersands (&&)...............fmx files). Property Description Name Name for the action Description Description of the action..... mark the key you want to use by placing an ampersand (&) in front of it. Oracle Developer: Build Forms II C-23 ...... are required to build ... Insert Input Item Insert Input Item is available only for global actions (Build....... If you want to use keyboard mnemonics............. 3 Specify the following properties in the Add Action dialog box.. or files of the type Forms Document... the P will furnish the mnemonic.. Insert Input Item becomes active and you can click it to select the type of input item required (for example.......... the description furnishes the menu item....... select the type or object that you want to modify....... 2 From the pop-up menu...... ...................fmb.................. Insert Macro Specify a macro that is expanded when the action is invoked...................... Pop-up menu Select the “Add to pop-up menu” check box if you want to include the action in the pop-up menu associated with the type or object. for example if you specify &Print as the description..... it will be inaccessible.... if you add an action that overwrites one of the global actions........................... Insert Application Specify the application you want to use to perform the action from the resulting Select an Application dialog box.... Deliver...... you can hide actions in this fashion without deleting them................ If you choose not to enter a description...Modifying Types Using Actions .. If you add this action to the pop-up menu......... the name of the action appears in the pop-up menu instead............ Select the Default check box if you want to make the action the default (invoked by double-clicking). Definition Specify the command string issued to invoke the action...................... ...................... If you choose not to include the action in the pop-up menu.. If you want to include a nonmnemonic ampersand in the command........................ select New Action to display the Add Action dialog box...

.................................................................................... All rights reserved.... 1999................................................................................................................................................... Customizing Actions by Using Macros Simple macros: myprinter = “HPLASER_01” Built-in macros: n = Full filename Predefined macros: D2KEDITOR = {EDITOR ? {EDITOR} : notepad} Copyright  Oracle Corporation.................. ............ C-24 Oracle Developer: Build Forms II .Appendix C: Project Builder Addendum ....................................

... In Motif...................... These macros have one character name and you cannot redefine the value.................... the macro D2KEDITOR is defined as {EDITOR ? {EDITOR} : notepad}.................... ............... Simple Macros Simple macros are macros that equate to simple strings............... Project Builder provides several macros for you to choose from. insert the macro name.... Possible values depend on the tools available on your platform.............. D2KEDITOR is defined as {EDITOR ? {EDITOR} : vi}...... Example For Windows platforms. If you want to reference a simple macro......................................... enclosed by braces.Customizing Actions by Using Macros .. or you can create your own................ Built-in Macros Built-in macros are macros provided by Project Builder for use with actions. Oracle Developer: Build Forms II C-25 .............. see the Project Builder online Help........ within the action or macro at the point in the command where such a string would be executed..... which means that your default editor will be Notepad unless you define a macro named EDITOR and equate it to another wordprocessing program available in Windows.... Note: For a complete list of the built-in macros... 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...................... 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......... Customizing Actions by Using Macros If an action needs to include special parameters.............. you can customize the action with a macro............. When you reference such a macro from an action or another macro........... the macro will be replaced by that string.............................

...................................................................................................... C-26 Oracle Developer: Build Forms II ................... 1999.......................................................... Defining and Using Macros Macros can: • Be defined for each object through the Property Palette • Be conditional • Reference other macros Copyright  Oracle Corporation....................................................................................................Appendix C: Project Builder Addendum ................. .... All rights reserved..

...... macros are recursively expanded...... the fully expanded action is displayed to the screen................ Preview Actions Mode Preview Actions mode allows you to test actions and see what values will be used for various parameters and macros without actually executing the action...... You can toggle Preview Actions mode on and off by selecting Project—>Preview Actions from the main menu..... Oracle Developer: Build Forms II C-27 .................................... enclosed by braces.......... ........ in the string comprising an action or another macro definition.. When you invoke an action in Preview Actions mode.. the value substituted for bar is the value of foo...................................................... To do so... use the Add Macro dialog box to name your macro and equate it to the string you want to execute when you use the macro............. Note: Placement of the macro reference is dictated by its value and how that relates to the command you are modifying. For example......Customizing Actions by Using Macros ......... if the value of a macro named bar is set to the already-defined macro {foo}. in the string to which the outer macro is equated........ and then the next..... when bar is referenced from within an action or another macro....... In addition............. Conditionalizing Macros You can set the value of a macro depending on a condition..... Defining and Using a Macro To define a macro........ insert the macro name....... until the action containing the nested macros is evaluated and executed........................ followed by the next level........... In other words.. enclosed by braces....... put the macro where you would normally enter the string to which the macro is equated............. 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 (Optional) The expression to which the macro is evaluated if the macro either has not 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.. To use a macro............. The innermost macros is expanded first..................

Appendix C: Project Builder Addendum
.....................................................................................................................................................

Customizing the Launcher

Copyright  Oracle Corporation, 1999. All rights reserved.

.....................................................................................................................................................
C-28
Oracle Developer: Build Forms II

Customizing the Launcher
.....................................................................................................................................................

Customizing the Launcher
You can add your own tools to the launcher, change the organization of the existing
tools by dragging and dropping, edit existing entries, and remove tools.
Adding Launcher Icons
1 Select Tools—>Preferences—>Launcher tab.
2 Click Add.
The Add Launcher Entry dialog box is displayed.
3 Enter the full pathname of the application, or click Insert Application to browse
your file system.
4 Enter the label that you want to display as the button text.
5 Select Icons Only to display this label as a tool tip, or select Icons and Text to
display the label below the icon in the launcher.
Editing Launcher Icons
1 Choose Tools—>Preferences—>Launcher tab.
2 Select the node for the icon you want to change.
3 Click Edit.
Make the necessary changes to the launcher entry.

.....................................................................................................................................................
Oracle Developer: Build Forms II
C-29

Appendix C: Project Builder Addendum
.....................................................................................................................................................

Inheritance in Project Builder
• Actions and macros can be defined for
types, projects, and components.
• Type action and macro definitions can
be overridden by the project or the
component.
Type
Type
• Every component also
inherits from the
<Any File> type.
Project
Project
• In Windows 95 and NT, file
type definitions are also
Component
Component
automatically inherited.
Copyright  Oracle Corporation, 1999. All rights reserved.

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
.....................................................................................................................................................

Inheritance in Project Builder
Inheritance Overview
The Property Palette shows not only the properties, actions, and macros, but also
whether they are inherited or overridden.
An entry inherits from its type the properties, actions, and macros associated with that
type. These include properties such as whether the file is text or binary and the actions
to edit or build an entry of that type.
An entry also inherits properties, actions, and macros from the project. Properties
inherited from the project include the author of an entry. If actions or macros are added
to the project, they are inherited by all entries in the project.
Note: Some properties, actions and macros can be inherited from both the project and
the type. In this case, setting the value at the project level overrides the value set at the
type level.
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

Copyright  Oracle Corporation, 1999. All rights reserved.

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

............. The global actions are a subset of the predefined actions and include the following: • Build actions (Build Selection.......................... Customization of predefined actions is covered in detail in Appendix C........... Note: Predefined actions are completely customizable.. Check Out.................................................................” Global Actions Global actions are included with Project Builder and work across projects and files....... adapting themselves to varied file types.......... 3 View the entries under the Actions node....... “Project Builder Addendum................ Lock File in RCS) ...... 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. To determine which predefined actions are available for a specific type: 1 Select that type in the Project Navigator.. 2 Display the Property Palette...... Predefined actions vary from file type to file type.. Get RCS Information.Actions ......... Build All) • Packaging action (Deliver) • Source control (Check In. Build Incremental...................... Oracle Developer: Build Forms II C-33 ... “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.............

......................... Summary This addendum covers the following topics: • Team development with Project Builder • Customize Project Builder • Inheritance in Project Builder Copyright  Oracle Corporation..........................................................................Appendix C: Project Builder Addendum .................................................................... ........ C-34 Oracle Developer: Build Forms II ...................... All rights reserved........................................................... 1999..............................................

............................................. Oracle Developer: Build Forms II C-35 ......................................................................................................Summary ................................................................................... Summary Team Development with Project Builder • Provide a Global Registry of common types • Import and export projects • Print and distribute project reports Customizing the Project Builder Environment • Create connections • Create actions • Create macros • Add tools to the toolbar .....................................................................

................................ .............................................................................................................................................................................Appendix C: Project Builder Addendum ................................................................................... C-36 Oracle Developer: Build Forms II ...........

....................D .......... Introduction to Oracle8 Object Features ...

.................................................................................. object columns................................. ... you should be able to: • Describe the new Oracle8 scalar data types • Describe object types and objects • Describe object tables..............................Appendix D: Introduction to Oracle8 Object Features .................. 1999. All rights reserved.................................. and object views • Describe the INSTEAD-OF triggers • Describe object REFs • Identify the display of objects in Object Navigator Copyright  Oracle Corporation............... Objectives After completing this appendix........................... D-2 Oracle Developer: Build Forms II ................................................................

................................................ This appendix also explains how these objects are displayed in the Object Navigator............................................................................................. Introduction In this appendix you will review certain object features of Oracle8........................................Introduction .............................. ............................................ Oracle Developer: Build Forms II D-3 ................................................

............................ 1999.............................. D-4 Oracle Developer: Build Forms II ........................................... All rights reserved............................................................................................. New Oracle8 Scalar Data Types • NCHAR • NVARCHAR2 • FLOAT • NLS types Copyright  Oracle Corporation.......................................................... ..................Appendix D: Introduction to Oracle8 Object Features ..................................

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

.................................................................................... 1999......................... D-6 Oracle Developer: Build Forms II ............................................... Object Types Attributes ORDER po_no custinfo line_items amount Methods Copyright  Oracle Corporation.............................................. ......Appendix D: Introduction to Oracle8 Object Features .................................................... All rights reserved............................................

......................... Attributes An object type is similar to a record type in that it is composed of one or more subparts that are of predefined data types.. When you create an object type you specify the component types from which it is built........ Just as the fields of a record type can be of other record types............. but object types call these subparts attributes. the attributes of an object type can be of other object types............................ You build object types from predefined data types or from previously defined object types... Thus.......................................... phoneNUMBER(9))........ Attributes define the object structure.... city VARCHAR2(15)...... Such an object type is called nested................ Record types call these subparts fields. CREATE TYPE phone_type AS OBJECT (country NUMBER(2)........................ zip CHAR(5))...................... Object types are like record types in another sense: Both of them must be declared as types before the actual object or record can be declared........... An object type must have one or more attributes and can contain methods................... .............. stateCHAR(2).. Object Types An object type is a user-defined composite data type................ an object type is in some ways similar to a record type.. area NUMBER(4).......... CREATE TYPE address_and_phone_type AS OBJECT (address address_type......... and in some ways similar to a package........... CREATE TYPE address_type AS OBJECT (address VARCHAR2(30)...Object Types ........... Oracle Developer: Build Forms II D-7 ...... phonephone_type).. You also specify the functions and procedures that can act on the object type.......

............................Appendix D: Introduction to Oracle8 Object Features ................................................................................ 1999.......................... Object Types Ship ORDER Cancel Check status Hold Copyright  Oracle Corporation........................................................................................................... D-8 Oracle Developer: Build Forms II .................... .............................. All rights reserved.............

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

........ These objects are not related to object types.. All rights reserved............. The term object can be confusing because Oracle uses the term to refer to constructs within the database........................ D-10 Oracle Developer: Build Forms II ................................................................ They are only blueprints for objects................Appendix D: Introduction to Oracle8 Object Features ...................................... 1999..................................... Instructor Note At this point.... Make certain your students are aware of the distinction between these terms......... procedures................................... for example..... ........ Object Tables Object table based on object type Copyright  Oracle Corporation...... and so on................ views........ tables..... review the fact that object types are not themselves objects.................

.... 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.............................. with the attribute of the object corresponding to the columns of the table...............................Creating Oracle8 Objects ..... Creating Oracle8 Objects Introduction After you have declared an object type.......................... you can create objects based on the type.................................................................... But there are significant differences........... Oracle Developer: Build Forms II D-11 ...................... Note: REF types are reviewed later............................ SQL and PL/SQL treat object tables very similarly to relational tables....... 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............................ ...........................

................................................................... Object Columns Object column based on object type Copyright  Oracle Corporation............................................................................ All rights reserved................................. D-12 Oracle Developer: Build Forms II ..................... ............Appendix D: Introduction to Oracle8 Object Features .................................................................... 1999...........................

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

........................................................................... All rights reserved... 1999.................................................... ................................................................Appendix D: Introduction to Oracle8 Object Features .................................... D-14 Oracle Developer: Build Forms II .......................... Object Views Object-oriented application Object view Relational table Object views based on object types Copyright  Oracle Corporation................................................

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

.................................................Appendix D: Introduction to Oracle8 Object Features ............................. D-16 Oracle Developer: Build Forms II ................................................ Nonupdatable view INSTEAD-OF trigger Copyright  Oracle Corporation.............. All rights reserved........... INSTEAD-OF Triggers DECLARE BEGIN EXCEPTION END............................................... ............................................................................................. 1999..............

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

...................... ............Appendix D: Introduction to Oracle8 Object Features ........................................ D-18 Oracle Developer: Build Forms II . References to Objects OID Copyright  Oracle Corporation...................................................................................................................... 1999............ All rights reserved...................................................................................................

. Or you can associate two objects by storing the OID of one object in an attribute of another........ hiredate DATE... job VARCHAR2(10)..... 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..... Referencing Objects Introduction In relational databases........ OIDs provide an alternate method...............2).................... In a similar way.. it is assigned automatically a unique identifier called an object ID (OID)............. The stored copy of the OID then becomes a pointer............................ or reference (REF)....... The object itself is not stored in the table...................... In object-relational databases........... Object REFs With relational tables........... The attribute or column that holds the OID is of data type REF.......... Note: The REF is scoped here to restrict the reference to a single table... only the OID value for the object is stored there......... sal NUMBER(7................... When a row in an object table or object view is created............. Oracle Developer: Build Forms II D-19 .... you can associate two records by storing the primary key of one record in one of the columns (the foreign-key column) of another..... ename VARCHAR2(10)...................... comm NUMBER(7.......... 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.....Referencing Objects .... dept REF dept_type SCOPE IS o_dept) ................ primary-key values are used to uniquely identify records......... .. Note: Object columns are not assigned OIDs and cannot be pointed to by a REF...........2).................. o_dept..... to the original object.... mgr NUMBER(4)...

...................... Object Types in Object Navigator Copyright  Oracle Corporation................Appendix D: Introduction to Oracle8 Object Features ........ 1999................................................................................... Object Type Wizard Copyright  Oracle Corporation................ D-20 Oracle Developer: Build Forms II ........................................................... All rights reserved.............................................................. 1999...................... All rights reserved................. ..

... which enables you to define attributes and methods...... views... along with tables...................................................... ........ and other Oracle objects... Additionally................................................................. Object Types Both the attributes and the methods are listed under each type... Displaying Oracle8 Objects in the Object Navigator In the Database Objects section........ the Object Navigator lists declared types.... Oracle8 Type Wizard You can create object types by using the Oracle8 Type Wizard...Displaying Oracle8 Objects in the Object Navigator ...... 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 ...................................................................................................................

...................... 1999........ 1999................................................... D-22 Oracle Developer: Build Forms II ...................... Object Tables in Object Navigator Copyright  Oracle Corporation................... All rights reserved........................ All rights reserved.................................................................. Object Columns in Object Navigator Copyright  Oracle Corporation.............................. ............................Appendix D: Introduction to Oracle8 Object Features .....................................

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

.................................................................... D-24 Oracle Developer: Build Forms II .........................................Appendix D: Introduction to Oracle8 Object Features ................................................................... 1999................................................ Object Views in Object Navigator Copyright  Oracle Corporation...... 1999..... All rights reserved... .............................................. All rights reserved....... INSTEAD-OF Trigger Dialog Box Copyright  Oracle Corporation................

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

.................................................................. ......................... All rights reserved.........................Appendix D: Introduction to Oracle8 Object Features ......................................... D-26 Oracle Developer: Build Forms II ....................................... Object REFs in Object Navigator Copyright  Oracle Corporation......................................... 1999...................................................................

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

.... Summary This appendix covers the following topics: • Oracle8 introduced three new scalar datatypes....... 1999..................................... object columns...................................................... All rights reserved...... • Objects and object types allow representation of complex data.................... All rights reserved........................... Summary • INSTEAD-OF triggers allow DML on object views.... and object views.......... • The Object Navigator can display certain types of objects.....Appendix D: Introduction to Oracle8 Object Features .................. ............... • Three kinds of objects are object tables.... D-28 Oracle Developer: Build Forms II .... Copyright  Oracle Corporation.. Copyright  Oracle Corporation....................................... 1999................................ • Object REFs store the object identifier of certain types of objects...........................

...... Oracle Developer: Build Forms II D-29 ..... and object views........... Oracle8 Objects In the Object Navigator The Object Navigator can display certain types of objects.......... object columns.......................... Summary New Oracle8 Data Types Oracle8 introduced three new scalar data types and new composite data types such as object types..............................Summary ................................................................. INSTEAD-OF triggers allow DML on object views................. Object REFs store the Object Identifier of certain types of objects.............................................................................. ................................................ Objects Three kinds of objects are object tables............

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
After completing this appendix, you
should be able to customize menu
modules by using substitution
parameters.

Copyright  Oracle Corporation, 1999. All rights reserved.

......................................................................................................................................................
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
......................................................................................................................................................

Built-in Substitution Parameters
UN

Current username

PW

Current password

AD

Directory name

SO

Current menu name

TT

Terminal type

LN

Language used
Copyright  Oracle Corporation, 1999. All rights reserved.

User-Named Substitution
Parameters

Design time

Run time

Copyright  Oracle Corporation, 1999. All rights reserved.

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 ................... Alternatively............................................... Form Builder automatically processes them at run time.................... A menu module provides some predefined parameters....... Predefined Substitution Parameters You can use six predefined (built-in) substitution parameters.... which automatically exist in every menu module......... they can be processed programmatically through built-in procedures.. Parameter UN PW AD SO TT LN Description Current username Current password Directory name containing the current menu module run-time file Current menu name (selected option) Terminal type used at connection Language used (NLS_LANG parameter) User-Named Substitution Parameters User-named substitution parameters are processed at run time by the user through a dialog box................... ........ 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......................... 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 ................................................ and substituted with a value at run time.............................. Note: Substitution parameter values can be referenced in triggers and userdefined subprograms....................................................................

.................................................... E-6 Oracle Developer: Build Forms II ....Appendix E: Menu Run-Time Parameters ........................ All rights reserved........ ................... 1999................................... Parameter Properties --Name Name --Label Label --Case CaseRestriction Restriction --Conceal ConcealData Data --Associated AssociatedMenus Menus --Maximum MaximumLength Length --Menu MenuParameter Parameter Initial Initial Value Value --Required Required --Hint Hint Copyright  Oracle Corporation..................................................................................................................................................................

.............................. Forms displays a new parameter......... Defining a User-Named Substitution Parameter Creating a User-Named Substitution Parameter You can create a user-named substitution parameter from the Object Navigator: 1 Select the Parameters node............................................ Oracle Developer: Build Forms II E-7 ................ 2 Create a new parameter by clicking the Create icon.................................................................................... lowercase........ 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 ................... displayed in the parameter value field when the Enter Parameter Values dialog box is displayed Required Mandatory or not............................................... Property Name Label Description The two-letter parameter name 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.. 3 Set the desired properties for the parameter..Defining a User-Named Substitution Parameter ... or none Conceal Data The property that determines whether the user’s input is echoed 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.............................................

.......................... Referencing and Applying Menu Parameters • In a menu item command: prefix the parameter name with & Example: &param_name • In a PL/SQL routine: – Prefix the parameter name with & when entered through a dialog box – Prefix the parameter name with : when entered in the PL/SQL editor Example: :param_name Copyright  Oracle Corporation................................................................... Instructor Note You can prompt for several menu parameters by using the following syntax: Query_Parameter(’&p1 &p2 &p3’).................. All rights reserved.. 1999.............Appendix E: Menu Run-Time Parameters .............................. 1999.................................................................................. E-8 Oracle Developer: Build Forms II ........ ....................................... All rights reserved.................. Substitution Parameter Built-ins • QUERY_PARAMETER • APPLICATION_PARAMETER Copyright  Oracle Corporation.....

. Oracle Developer: Build Forms II E-9 ... Prefix the parameter name with a colon (:) if the value is entered programmatically.. null).......... PLUS80W &UN/&PW @&CF Referencing a Parameter in a PL/SQL Routine Prefix the parameter name with an ampersand (&) if the value is entered through the Enter Parameter Values dialog box....................... pl_id........ Example This example invokes Report Builder and enables the user to provide the report name.... the values of menu substitution parameters can be referenced in triggers and user-named subprograms defined in the current form.... runtime.......... Substitution Parameter Built-ins Prompting for Substitution Parameter Values Built-in QUERY_PARAMETER Description Displays the Query Parameter dialog box showing the current values of the specified substitution parameters (End users can set the value of any parameter you include in the list........................ Query_Parameter(’&RN’)...Substitution Parameter Built-ins .......................................... Example This example invokes SQL*Plus and runs a command file (CF parameter)........... ..... provided that the menu in which the parameters are defined is the current menu................................ synchronous..) APPLICATION_PARAMETER Displays all the parameters associated with the current menu.. Run_Product(reports............................................ in the Enter Parameter Values dialog box Syntax for Referencing Substitution Parameters The syntax for referencing substitution parameters varies depending on how you enter the value...... Once assigned................. and their current values............ filesystem..... :RN.............. Referencing a Parameter in a Menu Item Command Prefix the parameter name with an ampersand (&).....................................

......................................... E-10 Oracle Developer: Build Forms II ....................................................................................... 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 Copyright  Oracle Corporation....................................................Appendix E: Menu Run-Time Parameters ........ 1999................................... All rights reserved............... ..................................................................

................................. END IF............... END LOOP......... BELL......... Oracle Developer: Build Forms II E-11 .................. END IF...................................................................................... END.............. BEGIN WHILE Status LOOP QUERY_PARAMETER(’&p1’)................................... IF MENU_SUCCESS THEN IF TO_NUMBER(:p1) not between 100 and 5000 THEN MESSAGE(’Qty must be in the range 100..... Validating a Substitution Parameter Value You can validate the user-entered substitution parameter values by using a WHILE loop including the QUERY_PARAMETER procedure and testing the MENU_SUCCESS function status...........Validating a Substitution Parameter Value ............... ELSE Status := FALSE.........5000’)...... ............................................. DECLARE Status BOOLEAN:= TRUE...

.........................................Appendix E: Menu Run-Time Parameters ............................ .......................... All rights reserved......................................................................................... E-12 Oracle Developer: Build Forms II .................................................... Summary This appendix covered substitution parameters.......... Copyright  Oracle Corporation......................... 1999..................................

&SO.............................................................................................................................. Oracle Developer: Build Forms II E-13 ............................... and &LN • Creating user-named substitution parameters • Programmatically controlling substitution parameters with QUERY_PARAMETER and APPLICATION_PARAMETER ....... Summary Substitution Parameters • Using &UN................................................................................. &TT.........Summary .................. &AD............. &PW.....................

......................................................................................Appendix E: Menu Run-Time Parameters ................................................................................................................... E-14 Oracle Developer: Build Forms II .................. ..................................................................................

.......... Handling Server-Side Errors .....F ..................

1999................................................................................... you should be able to: • Handle server-side database errors • Obtain the cause of declarativeconstraint violations Copyright  Oracle Corporation.......................... F-2 Oracle Developer: Build Forms II ............. Objectives After completing this appendix............ ............................................................................................... All rights reserved.................................................................Appendix F: Handling Server-Side Errors ...........

..... Oracle Developer: Build Forms II F-3 ...... Introduction Overview This lesson covers the use of Oracle server features in Form Builder applications................. Objectives At the end of this lesson....... including declarative-constraint violations....................................................... you should be able to: • Handle errors raised by the Oracle server • Obtain the cause of declarative-constraint violations ................................................................................................................................................................................................Introduction ............ You will learn about handling Oracle server errors...........

because the HANDLE_SERVER_ERROR procedure is covered later in this lesson.. Instructor Note Demonstration: Use the Handling of Server Errors (errh............ Run the form and point out that two messages appear for foreign key constraints........fmb) file to show the code for the STRIP_APPLICATION_ERROR function. check – ORA-02291: integrity constraint (schema................................. ....... F-4 Oracle Developer: Build Forms II ........ because the HANDLE_SERVER_ERROR procedure is covered later in this lesson...fmb) file to show how you can use your own message table to hold constraint messages...fmb) file to show the code for the STRIP_CONSTRAINT_NAME function.......................................... Demonstration for next page pair: Use the Message (msg......................................... Do not talk through all of the code. This function is the form part of the HANDLE_SERVER_ERROR procedure.................... This function forms part of the HANDLE_SERVER_ERROR procedure........ Do not talk through all the code........ Obtaining the Cause of Declarative-Constraint Violation • Predefined error messages for declarative constraints: – Primary/unique key..................Appendix F: Handling Server-Side Errors .................constraint) violatedparent key not found • Obtaining the name of violated constraint: Function STRIP_CONSTRAINT_NAME Copyright  Oracle Corporation................ All rights reserved............. 1999............. foreign key......... Use the Handling of Server Errors (errh.....................................

.... to strip out the name of the violated constraint from the Oracle Server error message....Obtaining the Cause of Declarative-Constraint Violations ..................................constraint) violated—child record found ORA-02290: check constraint (schema......... END................constraint) violated—parent key not found ORA-02292: integrity constraint (schema.......................1))...................................... RETURN(SUBSTR(p_error_text.. ’)’............ Predefined Error Messages for Declarative Constraints Constraint Primary Key Foreign Key Check Error Message ORA-00001: unique constraint (schema........................ such as the following................ Oracle Developer: Build Forms II F-5 ... v_start_pos)..............v_end_pos v_start_pos . v_end_pos := INSTR(p_error_text................’..............constraint) violated Unique Key ORA-02291: integrity constraint (schema........... Obtaining the Cause of Declarative-Constraint Violations To handle declarative-constraint violations effectively..... you must use the predefined error message to determine the constraint that was violated... v_end_pos NUMBER(4)........................constraint) violated Obtaining the Name of the Violated Constraint You can use string functions..... FUNCTION strip_constraint_name (p_error_text in VARCHAR2) RETURN VARCHAR2 IS v_start_pos NUMBER(4)............... BEGIN v_start_pos := INSTR(p_error_text. ’.. INSTR(p_error_text........... ..... v_start_pos + 1......... ’(’))....

...... All rights reserved..... Customizing Oracle Server Error Messages • Replacing declarative-constraint error messages: – Strip the constraint name from DBMS_ERROR_TEXT or SQLERRM – Retrieve the customized message from the messages table Copyright  Oracle Corporation...................................................................................................................... ................. 1999........... two error messages are associated with one foreign-key constraint name................ Customizing Oracle Server Error Messages • Replacing database-trigger error messages: – Strip the application error messages from DBMS_ERROR_TEXT or SQLERRM – Function STRIP_APPLICATION_ERROR • Replacing stored-program-unit error messages: Same as for database triggers............. Technical Note A foreign-key constraint violation can have two causes: “parent key not found” or “child record found........................Appendix F: Handling Server-Side Errors ... All rights reserved........... except SQLERRM only Copyright  Oracle Corporation............” Therefore..... 1999........................................ F-6 Oracle Developer: Build Forms II ..............................

which is already a customized message.... you can use this name to specify an appropriate customized message............................ Once you have obtained the name of the violated constraint from the Oracle server error message............ The first part of the error message is the message specified in RAISE_APPLICATION_ERROR in the database trigger................................... Customizing Oracle Server Error Messages Replacing Error Messages Caused by Declarative-Constraint Violations The error is reported in DBMS_ERROR_TEXT (implicit DML) or SQLERRM (explicit DML).................... v_end_pos ...Customizing Oracle Server Error Messages . ELSE RETURN(SUBSTR(p_error_text.... Replacing Error Messages Caused by Database Triggers The error is reported in DBMS_ERROR_TEXT (implicit DML) or SQLERRM (explicit DML).....11)).... Oracle Developer: Build Forms II F-7 ... You can then use the constraint name to retrieve the corresponding message from this table..... You can strip out this application-error message from the Oracle server error message by using the following function: FUNCTION strip_application_error (p_error_text in VARCHAR2) RETURN VARCHAR2 IS v_end_pos NUMBER(4).................... ’ORA-’. 5) . BEGIN v_end_pos := INSTR(p_error_text........... ......................... 12)).................. Replacing Error Messages Caused by Stored Program Units The error is reported in SQLERRM only........................ IF v_end_pos > 0 THEN RETURN(SUBSTR(p_error_text.......... The customized message is obtained in the same way as for database triggers.... END.............................2....... A flexible approach for this is to maintain a table of messages.......... END IF.................... 12....................

....... Copyright  Oracle Corporation......... Example Procedure for Handling Oracle Server Errors • If the Oracle server error is a declarative-constraint error: – Strip the constraint name from the Oracle server error text............................ ....................................... All rights reserved............................................. Copyright  Oracle Corporation..Appendix F: Handling Server-Side Errors ................... • Raise FORM_TRIGGER_FAILURE.......... – Retrieve the message from the messages table............................ Instructor Note Demonstration: Use the Handling of Server Errors (errh. This procedure contains both functions already discussed........................... 1999...... All rights reserved.............................................fmb) file to show the code for the HANDLE_SERVER_ERROR procedure.......... – Adjust the name of the foreign-key constraints.... Example Procedure for Handling Oracle Server Errors • If the Oracle server error is an application error: strip the application error from the Oracle server error text.. F-8 Oracle Developer: Build Forms II .............................. 1999...

...Example Procedure for Handling Oracle Server Errors ........................................... */ v_message_id := strip_constraint_name(p_server_error_text).... END IF................... . ELSIF p_server_error_code = -02292 THEN /* Foreign-key violation ......... END IF.................. p_server_error_text IN VARCHAR2) IS v_message_id VARCHAR2(255).... RAISE form_trigger_failure.............. Oracle Developer: Build Forms II F-9 ........................... BEGIN -...... */ MESSAGE(strip_application_error(p_server_error_text)). /* Foreign-key constraint has two associated error messages.handle_server_error IF p_server_error_code IN (-1................... -2290. The RETRIEVE_MESSAGE function retrieves a message with a given ID from a messages table... Example Procedure for Handling Oracle Server Errors PROCEDURE handle_server_error (p_server_error_code IN NUMBER............... ELSIF p_server_error_code between -20999 and -20000 THEN /* Application error caused by database trigger or stored program unit........................parent key not found......... RAISE form_trigger_failure....child record found....... Call the HANDLE_SERVER_ERROR procedure from the appropriate triggers and program units..... -2291........... -2292) THEN /* PK/UK/FK/CK-constraint violation error......*/ IF p_server_error_code = -02291 THEN /* Foreign-key violation ............. */ v_message_id := v_message_id || ’_CHILD’... MESSAGE(retrieve_message(v_message_id))................... Note: The STRIP_CONSTRAINT_NAME and STRIP_APPLICATION_ERROR functions have already been shown earlier in this lesson... */ v_message_id := v_message_id || ’_PARENT’....................... END handle_server_error............

........ Explanation for the next page pair: Remind students that all DDL operations issue an implicit commit and end the current transaction..... but any DDL statement can...... 40509.................... Form Builder is not allowed to process any pending changes..... Instructor Note Demonstration: Use the Handling of Server Errors (errh......................................... Copyright  Oracle Corporation.... Error code 40509 is update failed.................. 1999.... .. Technical Note Error code 40508 is insert failed................. Error code 40510 is delete failed.. 40510) THEN handle_server_error(DBMS_ERROR_CODE........ SQLERRM)......... DBMS_ERROR_TEXT)..Appendix F: Handling Server-Side Errors ...... Stress that FORMS_DDL itself does not issue an implicit commit..... handle_server_error(SQLCODE............... F-10 Oracle Developer: Build Forms II ............... This procedure is called from the On-Error trigger................ END IF.. All rights reserved...........fmb) demonstration file to show the code for the HANDLE_FRM_ERROR procedure........... SQLERRM).................................................. Handle errors caused by explicit DML or stored PUs: EXCEPTION EXCEPTION WHEN WHEN OTHERS OTHERS THEN THEN handle_server_error(SQLCODE..................................... Example Procedure for Handling Oracle Server Errors Handle errors caused by implicit DML On-Error trigger on form: IF ERROR_TYPE = ′FRM’ AND ERROR_CODE IN (40508....

................ BEGIN /* DML statements or calls to stored program units......................... Oracle Developer: Build Forms II F-11 ................................. END...... Handling Oracle Server Errors Caused By Explicit DML or Stored Program Unit Calls Define a WHEN OTHERS exception handler in all triggers and program units that execute explicit DML or call stored program units........... SQLERRM)..................... RAISE form_trigger_failure................... Handling Oracle Server Errors Caused by Implicit DML Always define an On-Error trigger to handle Oracle server errors caused by base table DML.................... On-Error Trigger at Form Level BEGIN IF ERROR_TYPE = ’FRM’ AND ERROR_CODE IN (40508........................... */ MESSAGE(ERROR_TYPE || TO_CHAR(-ERROR_CODE) || ’: ’ || ERROR_TEXT)........................ 40510) THEN handle_server_error(DBMS_ERROR_CODE........ */ EXCEPTION WHEN others THEN handle_server_error(SQLCODE..................DBMS_ERROR_TEXT)..................... ............................. END IF...... 40509. END................. /* Show default FRM-error message............Example Procedure for Handling Oracle Server Errors ..

....................................................................................................... F-12 Oracle Developer: Build Forms II ........ All rights reserved............. ................................................Appendix F: Handling Server-Side Errors ................................................... • Constraint: strip constraint name and retrieve message • DB triggers and stored program units: strip application error Copyright  Oracle Corporation................... Summary This appendix covered replacing Oracle server error messages with customized messages..... 1999..........................................................

...................................................................................................................................................................... Oracle Developer: Build Forms II F-13 ........................ database triggers..... Summary Handling Errors Raised by the Oracle Server • Causes: Declarative constraints....................................................Summary .............................................. 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 Replacing Oracle Server Error Messages with Customized Messages • Declarative constraint: Strip the constraint name from the Oracle Server error message and retrieve the message from the messages table • Database triggers and stored program units: Strip the application error message from the Oracle Server error message ..........

............................................................................................................................. ................................. F-14 Oracle Developer: Build Forms II ..........................................................................................................................................Appendix F: Handling Server-Side Errors .....

......... EMP_PKG Package ....................G ....

.............................Defines the Table of Records EMP TYPE emptab IS TABLE OF emprec INDEX BY BINARY_INTEGER........... --... ........ job emp..ename%TYPE.... --. --...empno%TYPE).......Appendix G: EMP_PKG Package .................................................empno%TYPE.. delete................Defines eack row of the table EMP empno emp.................... and lock rows of the */ /* EMP table..........deptno%TYPE).......EMPNO TYPE empnorec IS RECORD ( empno emp........ G-2 Oracle Developer: Build Forms II ........... ename emp....... update.....Defines the Table of Records EMP...... Package Specification /*******************************************************/ /* This is an example of a stored procedure that: */ /* query....Defines each row of the table EMP.. --.... insert...mgr%TYPE.........sal%TYPE...........Define the Ref Cursor TYPE empcur IS REF CURSOR RETURN emprec........ deptno emp..........comm%TYPE.......EMPNO TYPE empnotab IS TABLE OF empnorec INDEX BY BINARY_INTEGER.............job%TYPE..........hiredate%TYPE.. */ /* A package is used to logically group the related */ /* data types and procedures */ /*******************************************************/ PACKAGE emp_pkg AS TYPE emprec IS RECORD( --. comm emp........... hiredate emp.... sal emp.................. mgr emp........

............................................. p_deptno IN NUMBER)................................................... ..........Package Specification ......Defines the procedures used for DML operations PROCEDURE empinsert (block_data IN emptab)............................. --............Defines the procedures used for querying records PROCEDURE empquery_refcur ( block_data IN OUT empcur........... PROCEDURE empupdate (block_data IN emptab)................................. END........................ PROCEDURE emplock (block_data IN empnotab)........... --............... PROCEDURE empdelete (block_data IN empnotab)....................... p_deptno IN NUMBER)..................... Oracle Developer: Build Forms II G-3 ............... PROCEDURE empquery ( block_data IN OUT emptab......

...... END......... p_deptno IN NUMBER) IS BEGIN OPEN block_data FOR SELECT empno............ hiredate............... job............... .................Appendix G: EMP_PKG Package ........... ename............... .............. Package Body PACKAGE BODY emp_pkg AS /**************************/ /* QUERY USING REF CURSOR */ /**************************/ PROCEDURE empquery_refcur( block_data IN OUT empcur.............. sal.. comm.............................. .................... deptno FROM emp WHERE deptno = NVL(p_deptno......................... deptno) ORDER BY empno............. G-4 Oracle Developer: Build Forms II ....................... ... mgr.......................................................................

...... ename. block_data(i)..deptno.. END. block_data(i)............................. ......... p_deptno IN NUMBER) IS i NUMBER...empno............ /********************************/ /* QUERY USING TABLE OF RECORDS */ /********************************/ PROCEDURE empquery( block_data IN OUT emptab..comm.......................... BEGIN OPEN empselect.. ...... END LOOP........sal.......hiredate.. ............... block_data(i).... LOOP FETCH empselect INTO block_data(i)......... mgr........ sal.....mgr.ename..... block_data(i)...................... i := i + 1................................. job... block_data(i).... i := 1..................job...... ...... block_data(i).. block_data(i).... hiredate.... CURSOR empselect IS SELECT empno.......... deptno FROM emp WHERE deptno = NVL(p_deptno...Package Body ........... Oracle Developer: Build Forms II G-5 ..... deptno) ORDER BY empno. comm............................ EXIT WHEN empselect%NOTFOUND............

block_data(i).........job............... block_data(i)........ ..................deptno).. block_data(i)..................... ..................... block_data(i).............. END............... block_data(i).............sal.. ............................mgr..........comm........empno.. G-6 Oracle Developer: Build Forms II ..............count.. END LOOP.....hiredate.................... block_data(i)............ cnt NUMBER..cnt LOOP INSERT INTO emp( empno. hiredate.... . /**********/ /* INSERT */ /**********/ PROCEDURE empinsert(block_data IN emptab) IS i NUMBER....Appendix G: EMP_PKG Package . mgr.......... BEGIN cnt := block_data.................. FOR i IN 1.. deptno) VALUES( block_data(i).....ename..... comm......................... sal. ename.... job............ block_data(i).

empno........................................................count...deptno WHERE empno = block_data(i).............. deptno = block_data(i)...........................hiredate......ename................ sal = block_data(i)..............sal.........job...... /**********/ /* UPDATE */ /**********/ PROCEDURE empupdate(block_data IN emptab) IS i NUMBER....... cnt NUMBER... mgr = block_data(i).... hiredate = block_data(i). comm = block_data(i)..........cnt LOOP UPDATE emp SET ename = block_data(i)....... Oracle Developer: Build Forms II G-7 ...comm..... END LOOP..........mgr..................................................... ................. FOR i IN 1.............................. job = block_data(i)... BEGIN cnt := block_data........ END........Package Body ....

............................. .... mgr.............. cnt NUMBER........... END LOOP.................. END................................cnt LOOP DELETE FROM emp WHERE empno = block_data(i). ename................... /**********/ /* DELETE */ /**********/ PROCEDURE empdelete(block_data IN empnotab) IS i NUMBER........... G-8 Oracle Developer: Build Forms II ...count............. hiredate............................count......Appendix G: EMP_PKG Package ....... block_rec emprec.......empno........... BEGIN cnt := block_data................. BEGIN cnt := block_data................ comm.......cnt LOOP SELECT empno...empno FOR UPDATE OF ename NOWAIT................ END.. deptno INTO block_rec FROM emp WHERE empno = block_data(i)..... END LOOP...... END. FOR i IN 1.... cnt NUMBER........... sal... FOR i IN 1.. job....... /********/ /* LOCK */ /********/ PROCEDURE emplock(block_data IN empnotab) IS i NUMBER................

........... you can run the following script under Sql*Plus: DECLARE v_rec emp_pkg.... DBMS_OUTPUT.......PUT_LINE(v_rec.. END...... DBMS_OUTPUT..... LOOP FETCH v_ref INTO v_rec.............PUT_LINE(v_rec.. END LOOP..PUT_LINE(v_rec.. DBMS_OUTPUT..................PUT_LINE(v_rec...............PUT_LINE(v_rec.... CLOSE v_ref.....comm)............................................ 10)..........emprec......ename).emp_query_refcur(v_ref......................hiredate)... DBMS_OUTPUT............Package Body ....PUT_LINE(v_rec...........empcur.................. .......empno)..... BEGIN emp_pkg......sal)... v_ref emp_pkg..... DBMS_OUTPUT. To have an idea of how Form Builder works when a data block is based on a stored procedure returning a REF CURSOR...PUT_LINE(v_rec....job).......... DBMS_OUTPUT..PUT_LINE(v_rec...... EXIT WHEN v_ref%NOTFOUND.deptno).. DBMS_OUTPUT.....................................mgr). DBMS_OUTPUT............ Oracle Developer: Build Forms II G-9 ......

.....................................................................Appendix G: EMP_PKG Package .............................................................................................. G-10 Oracle Developer: Build Forms II ......................................................................................................................................... .

........H ....... Working with ActiveX Controls ..................

........ you should be able to do the following: • Explain the differences between VBX.................. Objectives After completing this lesson.....................Appendix H: Working with ActiveX Controls .............................................. and ActiveX controls • Access ActiveX properties at design time and run time • Import ActiveX control methods and event packages • Customize event handling Copyright  Oracle Corporation....... OCX................ .......................................... H-2 Oracle Developer: Build Forms II ....................................................... 1999..................................... All rights reserved.........................................................

.......... 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 ............................................................ OCX............................................................................................................................................... you will learn how to include and use ActiveX controls in your Oracle Developer application............... you should be able to do the following: • Explain the differences between VBX................... Introduction Overview In this lesson.. Objectives After completing this lesson............................................Introduction .........

....................................................... H-4 Oracle Developer: Build Forms II .................... and ActiveX Controls? VBX • Custom interface object • Special dynamic-link library OCX • Independent program module • Run in any Windows application that is OLE-enabled ActiveX • Third version of OCX • Provide integrated controls in Browsers Copyright  Oracle Corporation................. OCX.................................................. ......Appendix H: Working with ActiveX Controls ............................................ What Are VBX........ 1999.................................................................................................. All rights reserved........

............................. ActiveX is not a programming language..................... an OCX is an independent program module that can be accessed by other programs in a Windows environment............................................. and ActiveX controls provide encapsulated functionality that can be embedded into your application. Visual Basic...... spreadsheet documents...... While VBXs can be used in other environments.ocx extension.......... What Is an OCX? Short for OLE Custom control.. What Are VBX...... Word processor documents.......... including C.. OCX... an OCX.........What Are VBX......... C++...... and video clips are examples of component objects that can enhance the capabilities of your form............. Instead of re-creating functionality that already exists. They represent Microsoft’s third generation of control architecture........ ....... or an ActiveX control..... OCX controls end with the ...... OCX controls represent Microsoft’s second generation of control architecture........ OCX. Instead of one monolithic application that provides you with almost every feature that you want........ a VBX is a reusable software component designed for use in many different applications............ but rather a set of rules for how applications should share information.. component objects and good integration can provide you with a light-weight custom application to suit all your needs......... An application developer can use a number of selected VBXs to quickly develop an application... What Is a VBX? Short for Visual Basic custom control..... Programmers can develop ActiveX controls in a variety of languages... An ActiveX control can be automatically downloaded and executed by a Web browser....... OCX........ knob controls.......... Oracle Developer: Build Forms II H-5 .. the first being VBX controls written in Visual Basic... they were initially created for developing Windows applications with Visual Basic...... you can access these capabilities by exploiting a VBX.............. ActiveX is an open platform that combines desktop and Web technologies.. and ActiveX Controls? ....... the first being VBX controls and the second OCX controls........ What Is an ActiveX? ActiveX controls are a superset of OLE Custom control (OCX).. and ActiveX Controls? VBX.............. and Java.

................... OCX.................................. 1999..... and ActiveX Controls Comparison VBX Controls OCX Controls ActiveX Controls Operating “platform” 16-bit applications only Both 16............................... but not with Forms for the Web..............................Appendix H: Working with ActiveX Controls .............................................................................. H-6 Oracle Developer: Build Forms II .................................. VBX................................. Instructor Note ActiveX will work on the Web...................and 32-bit platforms Candidate applications Only those written with a specific interface to VBXs Any application with an OLE container type Coding interface Proprietary Standard OLE2 Webenabled No No Yes Copyright  Oracle Corporation.. ................. All rights reserved.......

.... OCX.................. OCX controls........and 32-bit platforms Both 16..................... They are 16-bit-only controls designed to execute an event. ActiveX controls are the third version of OLE controls (OCX).......................................................... An OCX is an extension of Windows Open Architecture................... Comparison of VBX........................Comparison of VBX.... and ActiveX controls............ and ActiveX Controls ... OCX....................... can execute events........ OCX controls support 16.... This means that all OCX controls are ActiveX controls....and 32-bit platforms Only those written with a specific interface to VBXs Any application with an OLE container type Any application with an OLE container type Proprietary Standard OLE2 Standard OLE2 No No Yes ................ They provide a number of enhancements specifically designed to facilitate distribution of components over high-latency networks and to provide integration of controls into Web browsers....................and 32-bit platforms....... and give the developer the ability to code methods and properties....... and ActiveX Controls A VBX is an extension of Microsoft Visual Basic and is designed to work within applications written with a specific interface to VBXs............................ The table below summarizes some of the differences among VBX controls..... Operating platform Candidate applications Coding interface Web-enabled VBX Controls OCX Controls ActiveX Controls 16-bit applications only Both 16...... Oracle Developer: Build Forms II H-7 . so it is designed to run in any Windows application that is OLE-enabled....................

....................... H-8 Oracle Developer: Build Forms II ....................Appendix H: Working with ActiveX Controls .......ocx files • Support events........... Similar to the Form Builder image item........... Similar to the Form Builder sound item.... Each of these controls has its own help file describing its properties..................................... methods.......... and events.. • Tabsheet: Tab controls.... 1999........ They are not supported by Oracle Corporation......................... • Spreadtable: Spreadtable... properties................... • Sound: Play and record sound clips... Provides more presentation options than the Form Builder tab canvas but is more complex to implement....................... control. Instructor Note The following ActiveX controls are included with demonstrations: • Image: Display and image files in a variety of formats........ . These controls are provided for demonstration purposes only..................... • Video: Play video (AVI) files..................... and methods ActiveX control item: • Container for the ActiveX control • Single-record property set to Yes Copyright  Oracle Corporation......... You can also view them from within Form Builder........ or grid....... These help files are located in the ORACLE_HOME\TOOLS\DOC60 directory... All rights reserved... ActiveX in Form Builder ActiveX controls: • Dynamic library in ................................

................ocx extension can contain more than one class of ActiveX objects.. ActiveX Control Components Each ActiveX control exposes a set of: • Properties: Properties define the ActiveX control’s physical and logical attributes... The Single Record property is not applicable to multiple record blocks............. Oracle Developer: Build Forms II H-9 .................... It is recommended that you use ActiveX controls in blocks with the Single Record property set to Yes....You should set the Single Record property to Yes because single records are immediately initialized when Forms run time starts up.............................. • Events: Events denote some change in status in the ActiveX control....................................... and intercepting and acting on events... ActiveX in Form Builder What Are ActiveX Controls? Form Builder provides support for ActiveX controls........ giving the impression that no ActiveX control is available.... • Methods: Methods define actions that the ActiveX control can perform........................................... ActiveX controls are a special type of dynamic library. Without initialization. Form Builder acts as an ActiveX control container......................ActiveX in Form Builder ....... ..... An ActiveX control is not a separate application....................... For multiple records.............. A client application manipulates an ActiveX control by writing values to and obtaining values from its properties.... ActiveX Control Item The ActiveX Control Item type creates a container for your ActiveX control...... A single ActiveX file that is distributed with the ... but a server that plugs into an ActiveX container...... invoking methods that are used to perform actions.. each record is not initialized until you navigate to the record............... the ActiveX Control Item is empty..................... ActiveX controls are reusable components that can be embedded in your Form Builder application.........

........................ 1998..................................... Copyright  Oracle Corporation.......... .............................Appendix H: Working with ActiveX Controls ....... All rights reserved................................. Create an ActiveX Control Container................ Insert an ActiveX Control..... Write the appropriate PL/SQL code................................................ 4........ 1999....... H-10 Oracle Developer: Build Forms II .......................... 2..... 3......... Implementing an ActiveX Control in Form Builder 1.............................. All rights reserved... Import the desired ActiveX Control methods and events... Creating an ActiveX Control Item H-7 Copyright  Oracle Corporation...............

........... The ActiveX control item is displayed........ 3 Import the desired ActiveX control methods and events............................. 2 Click the ActiveX control tool............ .... Oracle Developer: Build Forms II H-11 ................. The Properties Palette is displayed for the item....... invoking methods........ 4 Double-click the ActiveX control item........................... 4 Write the appropriate PL/SQL code—calling property accessors...... Implementing an ActiveX Control Using an ActiveX Control in Form Builder To use an ActiveX control in Form Builder: 1 Create an ActiveX control container..Implementing an ActiveX Control ......................... 3 Click the canvas............................................................................. 5 Set the item properties as required............ or responding to events—to interact with the ActiveX control................. 2 Insert an ActiveX control....................................... Creating an ActiveX Control Item You can create an ActiveX control item by: • Converting an existing item into an ActiveX control item • Using the ActiveX control tool in the Layout Editor • Using Create Icon in the Object Navigator • Using the Data Block Wizard To create an ActiveX control item in the Layout Editor: 1 Invoke the Layout Editor.............

....................Appendix H: Working with ActiveX Controls .................... 1999....... Inserting an ActiveX Control In the Layout Editor: 1............................ ActiveX Control Properties Set the following ActiveX control properties: OLE OLE Class Class Control Control Properties Properties About About Control Control Control Control Help Help Copyright  Oracle Corporation...................... Select a control type............... Technical Note If you have created a container using the OCX button from the Layout Editor........................ ...... 4. 3................................... 1999................. All rights reserved.......... Select the ActiveX control item............................ 2............................. Select Insert Object in the pop-up menu....... then Create Control is the only available option on the Insert Object dialog box... All rights reserved................ H-12 Oracle Developer: Build Forms II ...... Click the right mouse button..... Copyright  Oracle Corporation..................

.............. click the Create Control option button to display the valid control types...................................... 6 Click OK....... 3 Select Insert Object......) Control Properties Displays the specific properties for the current ActiveX control About Control Displays information about the control (Please note that this feature might not be exposed by the control that you are using........ select the ActiveX control item. ActiveX Control Properties Once the ActiveX control is inserted...... 4 In the Insert Object dialog box...................................................... Inserting an ActiveX Control in an ActiveX Control Item Inserting an ActiveX Control 1 In the Layout Editor.......................... but want to restrict the end users to creating OLE objects from a particular class. you may set the following properties: Property Name Description OLE Class Determines what class of OLE objects can reside in an OLE container...) Control Help Displays online Help for the control (Please note that this feature might not be exposed by the control that you are using. 5 Click a control type................................................................... Oracle Developer: Build Forms II H-13 ...........Inserting an ActiveX Control in an ActiveX Control Item ..............(You select a specific class if you want to create an application that allows end users to change the current OLE object in the OLE container..............) ..................................... 2 Click the right mouse button to enable the pop-up menu.......

.......................................................................................... All rights reserved........... H-14 Oracle Developer: Build Forms II .................Appendix H: Working with ActiveX Controls ............... 1999................ 5 Copyright  Oracle Corporation.... Importing ActiveX Methods and Events Packages 1 Select Program OLE Importer 2 6 ...................................................................Program Units + + + 3 4 PackageName1 (Spec) PackageName1 (Body) ................ ........................................................................

................................................. enabling you to interact with ActiveX controls in the native Form Builder environment............................... notice the newly created packages under the Program Units node............................................. 5 Select the Properties check box to import the get and set accessors for properties....... The methods and events packages appear for the selected OLE class.......... Importing ActiveX Control Methods and Events 1 Select Program––>OLE Importer... 2 Select an OLE Class........................................ Oracle Developer: Build Forms II H-15 .. 3 Control-click on the desired methods and events packages............ Form Builder imports the methods and events in PL/SQL..................................... ... 6 Click OK........................ In the Object Navigator.............. 4 Select the Methods check box to import the methods...Importing ActiveX Control Methods and Events Packages .... The OLE Importer dialog box appears............... Importing ActiveX Control Methods and Events Packages ActiveX controls export interfaces that expose methods and events.................

..................Needleposition ++ 1.OCX.. Setting and Getting ActiveX Control Properties Three methods: • Bind variable Syntax :Item( :Item(′item_name’). All rights reserved.. Spindial.................................Needleposition:=:item(’ActXitem’)............Spindial..............1..... Copyright  Oracle Corporation....... Interacting with an ActiveX Control You can interact for: • Setting and getting ActiveX control properties • Invoking ActiveX control methods • Responding to ActiveX control events Copyright  Oracle Corporation.....spindialctrl .....property ′item_name’).....Appendix H: Working with ActiveX Controls .spindialctrl ′ActXitem’).....OCX...spindialctrl.............OCX............1.....OCX..Needleposition:=:item(’ActXitem’)...Needleposition Spindial.OCX... ....property Example :item( :item(′ActXitem’)............ 1999.......... ................................ H-16 Oracle Developer: Build Forms II ....Spindial...........................1.........................server_name....OCX.............1.. All rights reserved.......... 1999.....spindialctrl....server_name..................... 1....

.Needleposition := :item(’ActXitem’).....Setting and Getting ActiveX Control Properties ... Spindial..OCX..........1..spindialctrl..... Oracle Developer: Build Forms II H-17 ...........spindialctrl...spindialctrl........... Property is the name of a specific property of the ActiveX control..........Needlposition + 1......... if available.......... and Needleposition is the name of the property.................... /* ActXitem is the name of the item.......... or the documentation...............OCX......1. Setting and Getting ActiveX Control Properties Once the ActiveX control is inserted and the methods and events packages are imported.spindial................Needleposition +1.............cursor_item............cursor_item is an ActiveX control: */ :form...1.................OCX................spindialctrl.... you can interact with ActiveX controls in many ways: • Setting and getting ActiveX control properties • Invoking ActiveX control methods • Responding to ActiveX control events There are several ways to set and get ActiveX properties values.....Spindial....... /* Setting an ActiveX control property using bind variable syntax */ :item(’ActXitem’)........................property Server_name represents the name of the server................ To obtain more information...... :item(’item_name’).spindialctrl.. see the Control Help property.....1..... ......Needlposition := :form...server_name... */ /* The following code also works if your system............ocx...cursor_item.Spindial.....spindial.OCX.... Bind Variable Syntax You can use the bind variable syntax to assign or retrieve property values............... This name is the one you have selected for the OLE Class property...1 is the name of the ActiveX control server.

................................................ 1999.. All rights reserved........................... Setting and Getting ActiveX Control Properties • Control Properties dialog box – Displays ActiveX-specific properties – See Control Help property or documentation Copyright  Oracle Corporation..................................... Copyright  Oracle Corporation........Oitm’)............ 1999..................... tblname := table_pkg........................ ...... Setting and Getting ActiveX Control Properties • Property accessors (PL/SQL procedures) tblname varchar2.. H-18 Oracle Developer: Build Forms II .. All rights reserved.......................................................Appendix H: Working with ActiveX Controls ..............interface).......................TableName( :item(’Oblk...............................

....... generated from the OLE Importer........ Oblk is the name of the block and Oitm is the name of the item...... The Control Properties dialog box appears............................... 4 Click OK....... and use the property accessor procedures to set a property value................ Property Accessors (PL/SQL Procedures) You can set and get property values with the program units............Setting and Getting ActiveX Control Properties .......... /* Getting an ActiveX control property using get accessor*/ tblname varchar2.................. /* table_pkg is the name of the program unit created from the OLE Importer...... TableName is the name of the property accessor. 3 Set the control properties accordingly...interface)............ 2 Click the Control Properties property............................................................. called property accessor functions and property accessor procedures................*/ Control Properties Dialog Box from the Property Palette 1 In the Object Navigator....................................... .................. tblname := table_pkg..TableName(:item(’Oblk............... Oracle Developer: Build Forms II H-19 .......... Use the property accessor functions to get a property value........... double-click the object icon next to the ActiveX control item to display the Property Palette.Oitm’)..........

................................video′).......................................... ............................PLAY(:item ((′video_ocx....... 1999. Copyright  Oracle Corporation.PLAY(:item MMVX_DMMVX..........video ′video_ocx... H-20 Oracle Developer: Build Forms II ........... All rights reserved....................INTERFACE)........................................INTERFACE)................... Invoking ActiveX Control Methods MMVX_DMMVX...........................Appendix H: Working with ActiveX Controls ................................................ ′).......................

....................... OLEObj OleObj....... Invoking ActiveX Control Methods Methods define actions that the ActiveX control can perform......... Oracle Developer: Build Forms II H-21 ............................. see the documentation of this ActiveX control or..ITM’).... To obtain information on a specific method of an ActiveX control... Example /* Getting a cell value from a Spread Table ActiveX control using the GetCellByColRow method provided in the SpreadTable package */ DECLARE Cur_Row number..............CurrentRow(:ITEM(’BLK.... Cur_Col........ Cur_Row)....GetCellByColRow(:ITEM(’BLK......... OLEObj:=SpreadTable. Call any of the methods in any of the packages available under the Program Units node....... the Control Help property....ITM’)..........interface).......... Cur_Col:=SpreadTable... BEGIN Cur_Row:=SpreadTable..........Invoking ActiveX Control Methods ............. .......... END......................CurrentCol(:ITEM(’BLK. How to Invoke a Method You can access methods exposed by an ActiveX control with the program units generated from the OLE Importer..........................interface)......................interface.......................................ITM’).......................... if available..... Cur_Col number.

• Use the When-New-Item-Instance or When-New-Record-Instance triggers in place............ BEGIN /* Write your code here */ END........ Responding to ActiveX Control Events Two ways to deal with events: • Directly call the appropriate restricted procedure............... 1999......................DISPATCH_EVENT (RESTRICTED_UNALLOWED)............................................ • Code the On-Dispatch-Event trigger.. PROCEDURE /*Click*/ event4294966696 (interface OleObj).............Appendix H: Working with ActiveX Controls ............... Initialization events do not fire................................ • To run in unrestricted mode......................... Responding to ActiveX Control Events All event procedures are restricted............... ............................................................. use: FORMS4W.. Copyright  Oracle Corporation. H-22 Oracle Developer: Build Forms II . All rights reserved........... Copyright  Oracle Corporation........ All rights reserved................. 1999.............

........Responding to ActiveX Control Events ................ In the unrestricted case.. However...... the code in the procedure is automatically executed... this is the unrestricted case.. Instead...... . FORMS4W........... The restricted procedure produced by an event has an application programming interface similar to the following: PROCEDURE /*Click*/ event4294966696(interface OleObj). These initialization events are intentionally disabled..................... Each event is associated with a PL/SQL procedure defined in the events package.......................................................................DISPATCH_EVENT(RESTRICTED_ALLOWED)...................... you can use When-New-Item-Instance or When-New-Record-Instance triggers in place of the control’s native initialization events........................... Type directly into the event package body and compile the package.... that is............... When the control fires an event..... Responding to ActiveX Control Events ActiveX controls invoke events. The events are defined by the ActiveX control....... call: FORMS4W.... Another way to deal with the event is to add code to the On-Dispatch-Event trigger. The procedures are named according to an internal numeric representation as defined by the control... You are responsible for providing the code to respond to the event.... Oracle Developer: Build Forms II H-23 ..DISPATCH_EVENT(RESTRICTED_UNALLOWED)............... go_item cannot be called from within the procedure code................. There is no need to explicitly call the event procedure because it will automatically be called following the On-Dispatch trigger code..... Form Builder exposes these events in the events package created from the OLE Importer........... Restricted or Unrestricted Mode All event procedures are restricted.......... Initialization Events Initialization events for ActiveX controls do not fire in Forms run time...... you need to do the following: In the On-DispatchEvent Trigger (block or form level).. there are instances when the same event may apply to multiple items and a go_item is necessary....................

............... errHelpContext)....................... ... errHelpfile.......................Appendix H: Working with ActiveX Controls ....... • Use the LAST_OLE_EXCEPTION built-in to get more detailed information......... ............ Technical Note The LAST_OLE_EXCEPTION built-in takes variables.......... WHEN FORMS_OLE_FAILURE THEN ExceptNum :=LAST_OLE_EXCEPTION(errScr........................... 1999.... ...................... .................... the FORMS_OLE_FAILURE is raised................................ All rights reserved................................ not constants..................................... ............. Copyright  Oracle Corporation...... Handling Exceptions • When a failure occurs.. errDescription.. H-24 Oracle Developer: Build Forms II ......... ..... ......

............. errHelpfile....................... .......................... errHelpContext PLS_INTEGER....’||errDescription).............Inform the user of the problem MESSAGE(errSrc||’..... errDescription........................... WHEN form_ole_failure THEN errCode := LAST_OLE_EXCEPTION(errSrc................................................ END..... .... .. 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’))......................................Handling Exceptions ............................. When a FORMS_OLE_FAILURE exception is raised.. an FRM message appears or the FORMS_OLE_FAILURE exception is raised... errDescription VARCHAR2(2000). errSrc VARCHAR2(200). BEGIN ...... An exception is raised because Jane is not a number........................ */ DECLARE errCode PLS_INTEGER........... Handling Exceptions FORMS_OLE_FAILURE Exception When a failure is detected in handling an ActiveX control method........ Oracle Developer: Build Forms II H-25 ... errHelpContext)..... errHelpfile VARCHAR2(200). -..................

.... ................exe explicitly..................... H-26 Oracle Developer: Build Forms II .................................................................................... Registering an ActiveX Control Two methods to register: • Implicitly register using the installation program. Copyright  Oracle Corporation................................................... • Use regsvr32.......................Appendix H: Working with ActiveX Controls ................................... ActiveX controls require supporting DLL Must be in \Windows\System or search path Reregister the ActiveX control if you move it or rename its directory............................. 1999........................ All rights reserved....................

.... or rename the directory........................ Moving ActiveX Control Files At installation............................ Most reputable ActiveX control suppliers provide documentation regarding the version and name of the DLLs required........ your ActiveX control will not register properly....... The DLL must be in the \WINDOWS\SYSTEM directory or in the search path..........dll.............................. Oracle Developer: Build Forms II H-27 ........... use regsvr32.................. some even supply and install them along with the ActiveX controls..... the directories in which the ActiveX control is installed are registered in the Windows Registration Database in Windows 95 and Windows NT..exe..................... Supporting Files Most ActiveX controls require a supporting DLL......exe utilities provided with most Microsoft development products to reregister the ActiveX in its new location..... such as the Microsoft Foundation Class run-time library...Registering an ActiveX Control ............exe or regActiveX....................... If you move the ActiveX control to a different directory......... mfc40.................................. If you install an ActiveX control by using the installation program supplied with the ActiveX control...... the registration is most likely taken care of by the installation program....... the information in the registry is no longer valid....... this program is available with Microsoft development tools and from ActiveX control vendors. Registering an ActiveX Control You must register all ActiveX controls.... ........ If the DLL is out of date or missing....... use the regsrv32. For manual registration of ActiveX controls...... If you must move the ActiveX control or rename its directory.................. making the ActiveX control visible to your development environment..

......................................... 1999.......... Summary • VBX.......................... OCX............ ......................................................................................................... H-28 Oracle Developer: Build Forms II ............... All rights reserved...................... and ActiveX controls • Differences among controls • ActiveX control in Form Builder • Create an ActiveX control container • Set and get ActiveX control properties • Invoke ActiveX control methods • Respond to ActiveX control events • Register an ActiveX control Copyright  Oracle Corporation..............................................Appendix H: Working with ActiveX Controls . .............................

...................................................................................Summary ..... you saw how to include and use ActiveX controls in your Oracle Developer application................. 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 .............................................. OCX.. Summary In this lesson......................................................................................................................... • VBX................. Oracle Developer: Build Forms II H-29 ..............

.............................................. ......... H-30 Oracle Developer: Build Forms II ...........................................................................................Appendix H: Working with ActiveX Controls ...........................................................................................................................................................

.I ........................ Using Oracle Server Roles at Run Time ........

.......................Appendix I: Using Oracle Server Roles at Run Time ............... Oracle Server Views for Roles • SESSION_ROLES • ROLE_ROLE_PRIVS • ROLE_SYS_PRIVS • ROLE_TAB_PRIVS Copyright  Oracle Corporation................. ......... 1999........................................................................................................ I-2 Oracle Developer: Build Forms II ................................................................... All rights reserved.....................................................................

.............................................................................. Subprograms belonging to the DBMS_SESSION package enable you to modify the roles that are used by the menu module to enforce security................................................................................... Using Oracle Server Roles at Run Time Overview You can manipulate roles dynamically at run time by using Forms.. Oracle Developer: Build Forms II I-3 ......... you can select views from the data dictionary to get information about existing roles............................ SESSION_ROLES View Roles that the user currently has enabled Column ROLE Description Name of the role ROLE_ROLE_PRIVS View Information about roles granted to other roles Column ROLE GRANTED_ROLE ADMIN_OPTION Description Name of the role Role that was granted Subprogram that signifies that the role was granted with the ADMIN option ROLE_SYS_PRIVS View Information about system privileges granted to roles Column ROLE PRIVILEGES ADMIN_OPTION Description Name of the role System privileges granted to the role Column that signifies the grant was with the ADMIN option .......................................................Using Oracle Server Roles at Run Time .................... For example..............................

.. 1999........Appendix I: Using Oracle Server Roles at Run Time .................... ........... I-4 Oracle Developer: Build Forms II ........................................................................................................................................................................................................................................ Oracle Server Views for Roles • SESSION_ROLES • ROLE_ROLE_PRIVS • ROLE_SYS_PRIVS • ROLE_TAB_PRIVS Copyright  Oracle Corporation....................... All rights reserved........

.. otherwise NO ........................ Oracle Developer: Build Forms II I-5 ............................................................................................................................................................................................ Column ROLE OWNER TABLE_NAME COLUMN_NAME PRIVILEGE GRANTABLE Description Name of the role Owner of the object Name of the object Name of the column....Using Oracle Server Roles at Run Time ..... ROLE_TAB_PRIVS View Information about table privileges granted to roles......................................................... if applicable Object privilege granted to the role YES if the role was granted with the ADMIN option........................

............................. All rights reserved............................ ........................................................Appendix I: Using Oracle Server Roles at Run Time ............................................. 1999........IS_ROLE_ENABLED Copyright  Oracle Corporation............................................. I-6 Oracle Developer: Build Forms II ............ Procedures for Managing Roles • DBMS_SESSION........................................SET_ROLE • DBMS_SESSION...........................................

................................................. END IF....................... PAUSE............................ Two of them are used to manage menu module roles dynamically..................... RAISE form_trigger_failure...................... DBMS_SESSION...... Procedures for Managing Roles Package DBMS_SESSION DBMS_SESSION................ Oracle Developer: Build Forms II I-7 .............. .. IF not (DBMS_SESSION..................IS_ROLE_ENABLED (‘RoleName’) Example The following Pre-Form trigger uses the DBMS_SESSION package to test a user’s role before allowing access to the application........IS_ROLE_ENABLED(’TECHNICAL’) THEN MESSAGE(’You are not authorized to run this application’).............................................. This package is used to assign a particular role to the current user..........Procedures for Managing Roles .......IS_ROLE_ENABLED(’ADMINISTRATIVE’) or (DBMS_SESSION..........................SET_ROLE (‘RoleName’) Description DBMS_SESSION is a standard package that comprises many subroutines.................

.................................................................. I-8 Oracle Developer: Build Forms II ............................................................................................................................................................................................................... ..........Appendix I: Using Oracle Server Roles at Run Time ..................

... Instructor Note ...........................J ...

.................. and the final Summit application from Project Builder....... Introduction Project Builder is presented in Lesson 1...............Appendix J: Instructor Note ............................................ practice files........ practice solutions... ....... use it throughout the course..... To help the students get familiar with this tool.............................. PowerPoint slides............. J-2 Oracle Developer: Build Forms II ................................................................................... A project named Oracle Developer: Build Forms II is provided................................................................... so that you can launch all course demonstrations..........

) 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.) Instructor Slides Contains all the powerpoint slides of the course......... Practice Solutions Contains all the ...................................................... ...........ico... . ........... (Those demonstrations are classified by lesson.. Oracle Developer: Build Forms II J-3 ......) ....... ..tif.......................How the Project Is Organized ......mmb files for the practice solutions Start Forms Contains all the files (......................................................fmb.....tif.............................. ..) Summit Application Contains all the files (............ ................... ..... Each lesson correspond to a subsubproject......................fmb............ico............ How the Project Is Organized Oracle Developer: Build Forms II contains the following subprojects and subsubprojects: Subproject Description Instructor Demonstrations Contains all the demonstrations of the course.) to start the practices (Those files are similar to the one the students have................fmb..

.................... Project Setup Importing the User Registry 1 Launch Project Builder.. Click the Cancel button....Appendix J: Instructor Note ........ 3 Delete all the entries (if any exist)............... 9 Click the Close button......OLB File ... 10 Expand the User Registry node and verify that the following types have been imported: .. The Select File to Import dialog box is displayed.......................... 2 Expand the User Registry node.................................................................................TIF File ......... 6 Click the Override existing types check box..........PPT File .............................ICO File ....... 8 From your course home directory... 5 Click the Import types check box... The Import Options dialog box is displayed.................. The Welcome dialog box is displayed....... 7 Click the Import button...SQL File .....................upx file..... select the reg...................... 4 Select File––>Import Project........ J-4 Oracle Developer: Build Forms II .........

.............................Instructor Demonstrations ... 3 Enter your instructor user name in the Username field................... If a project is loaded. Oracle Developer: Build Forms II J-5 ......................................... Loading the Project 1 Verify that no projects are loaded... select the form2............................. 4 Enter your instructor password in the Password field...... select File—>Close Project to close it............. ....... The Add Connection dialog box is displayed.. The Open Project dialog box is displayed. All the files in the project have inherited this connection.......upd file...Instructor Slides .. 3 From your course home directory..... 6 Click the OK button..........Practice Solutions ............ 2 Enter SUMMIT in the Title field....... 5 Enter the database connect string corresponding to your instructor account in the Database field......Summit Application Assigning a Connect String to the Project 1 Select File––>New––>Connection...Project Setup ................................ 8 Drag the SUMMIT connection to the Oracle Developer: Build Forms II project node.... 2 Select File—>Open Project..................... 4 Expand the Oracle Developer: Build Forms II project node and verify that the following subprojects exist: ...Start Forms .......... 7 Expand the Connections node and select the SUMMIT connection.............................................

..........Appendix J: Instructor Note ............... subproject.............................................. your demonstration directory is C:\Forms2\Demos.................. If your course home directory is C:\Forms2............................................. you should enter the following values in the Project Directory property: Project-Subproject-SubSubproject Value for the Project Directory property Oracle Developer: Build Forms II Project C:\Forms2 Instructor Demos Subproject C:\Forms2\Demos Lesson 02 and 03: Menus Subsubproject C:\Forms2\Demos Lesson 04: Programming Function Keys Subsubproject C:\Forms2\Demos Lesson 05: Responding to Mouse Events Subsubproject C:\Forms2\Demos Lesson 06: Controlling Windows and Canvases Programmatically Subsubproject C:\Forms2\Demos Lesson 07: Controlling Data Block Relationships Subsubproject C:\Forms2\Demos Lesson 08: Building Multiple Form Applications Subsubproject C:\Forms2\Demos Lesson 09: Defining Data Sources Subsubproject C:\Forms2\Demos Lesson 10: Working with Record Groups Subsubproject C:\Forms2\Demos Lesson 11: Including Charts and Reports Subsubproject C:\Forms2\Demos Lesson 12: Applying Timers Subsubproject C:\Forms2\Demos Lesson 13: Reusable Components Subsubproject C:\Forms2\Demos Lesson 14: Using Server Features in Form Builder Subsubproject C:\Forms2\Demos Appendix H: Working With ActiveX Controls Subsubproject C:\Forms2\Demos ..... and subsubproject files are located..... J-6 Oracle Developer: Build Forms II . You must define this property............. This property indicates to Project Builder in which directory the project..... your lab solutions directory is C:\Forms2\Lab_Sol......................... and subsubproject you will have to set the Project Directory property......................... your labs directory is C:\Forms2\Labs.............................. subproject....... your slides directory is C:\Forms2\Slides .................................... Changing the Project Directory Paths For each project.............. and your Summit application directory is C:\Forms2\Summit..............

....................... 4 Select the appropriate directory for the current project..... 3 Click the button next to the Project Directory property.................. do the following: 1 Select Tools—>Property Palette........................... or subsubproject... 2 Select the Project Directory property.......... Project-Subproject-SubSubproject Value for the Project Directory property Instructor Slides Subproject C:\Forms2\Slides Practice Solutions Subproject C:\Forms2\Labs Start Forms Subproject C:\Forms2\Lab_Sol Summit Application Subproject C:\Forms2\Summit To set this property.. The Property Editor dialog box is displayed................................................ Oracle Developer: Build Forms II J-7 .......................................... ......... subproject.......................................................Project Setup ...................................................................

.. Launching the Files Launching a Powerpoint Slide 1 Expand the Instructor Slides subproject node............. it refers to the name of the demonstration in Project Builder.......... 3 Select the Run Script option......... 4 Select the demonstration you want to show. the demonstration will be located in the subsubproject corresponding to the current lesson.... We strongly recommend that before you start to teach the course you compile all the files......... Launching a Demonstration File Be aware that the demonstration files have not been compiled..... and compile them.... Enjoy your teaching! ............. because the Compile Selection option in Project Builder do not work properly........ 3 Expand the Forms Builder executable node..................mmb files.. J-8 Oracle Developer: Build Forms II .......... 2 Expand the subsubproject node corresponding to the current lesson........... we recommend that you launch Form Builder....fmb and .................... 2 Expand the PPT file node.. Running a SQL Script 1 Select the SQL script. A pop-up menu is displayed......... By default..................... 1 Expand the Instructor Demonstrations subproject node............. 3 Double-click on the lesson you want to displayed........ 2 Click on the right mouse button.. 5 Click on the right mouse button.... Also.................................... In other words.... 6 Select the Run option............... it means that no fmx and mmx files are available........ You have to compile them before you can run a demonstration.......................................Appendix J: Instructor Note ......... open each ............... Important Note Whenever this book asks you to run a demonstration.

Sign up to vote on this title
UsefulNot useful

Master Your Semester with Scribd & The New York Times

Special offer for students: Only $4.99/month.

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

Cancel anytime.