Page 262
FIG. 11.11
The Employee Form after
the query has been
cancelled.
CAUTION |
A common error users make with Oracle Forms occurs when the query does not return records. The users see that the majority of the fields are blank. They believe the form is in the input mode and enter values into the form. When they try to save the record, an error message occurs. In addition, the values they have entered will be lost. |
Records added to the form are not placed into the database until a commit command is issued. This is also true for changes made in the change mode or for record deletions. The database modifications are temporary until the commit is issued.
The commit command is issued one of three ways: press the Save button on the button palette, or press the F10 or commit function key, or select the Action/Save option from the menu. When the changes have been saved, the form displays a message saying FRM-40400:Transaction Complete... A successful save procedure is illustrated in Figure 11.12.
At times database errors occur when operating a Form. This occurs often when the PL/SQL code does not have adequate exception handling. A common error is trying to add a record that has the same primary key as an existing record. It is important to see what the error is in order to correct the problem. Oracle Forms provides a special database error dialog box that can be displayed. It is displayed by pressing the shift-F1 function key or selecting the Help/Display Error menu option. Figure 11.13 illustrates the Database Error dialog box. The box displays an error message for a unique duplicate primary key error.
Page 263
FIG. 11.12
A successful Form Save
procedure.
FIG. 11.13
Using the Database
Error dialog box to
identify a database
error.
A form is a graphical user interface application used to maintain a database. Oracle Forms 4.5 is Oracle's product for developing a form. A form has a number of components, generally consisting of a number of sections or blocks linked to a specific table. The block resides on a canvas and has a number of fields or items. When multiple blocks reside on a canvas, one of the blocks is the master block and the others are detail blocks. The master block generally contains information unique to the entity. The detail blocks contain records from the related tables.
Oracle Forms uses three types of files or modules. They are the form, menu, and library modules. The form source code resides in file with a file extension of .FMB. The executable code file has an extension of .FMX. The menu source and executable code reside in .MMB and .MMX type files. Finally, the library module uses .PLL and .PLX.
Forms have three products. Forms Designer is used to build and maintain the application. Forms Generate is used to create an .FMX executable file. Forms Runtime is used to launch and execute a form.
Page 264
A form has three operating modes. The input mode is used to add records to the database. The change mode is used to update records. The query mode is used to retrieve records for update or display.
When querying a record, all fields on the form can be search fields. Pressing the execute query function key causes the application to create a dynamic or runtime select statement. Each item that contains a value will be contained in the where clause of the statement. The fields also support wildcard searches using `%' and "_'.
Queries may be canceled by pressing the exit-form function key. Queries are executed by pressing the F8 function key or the Query button when the form is in Query mode. Screen changes are saved permanently when the Save button or F10 function key is pressed. The form can be place in the input mode by canceling a query or pressing the create record function key.
The next chapter introduces you to Oracle Forms Designer. This is the product used to develop the forms that we learned to operate in this chapter. You see how easy it is to create a simple form. The chapter also discusses how to use the object navigator and the Designer menu options.