Page 327
Up to this point, you've learned a considerable amount about using SQL to create an Oracle database, query a table, and modify the contents of a table. You've also learned how to use PL/SQL to develop application logic in the form of stored procedures, functions, and packagesand how to create database triggers for different purposes.
Now it's time to delve into the development of an Oracle application with Developer/2000. In this lesson, and Days 14 through 17, you'll learn the role that each component of Developer/2000Oracle Forms, Oracle Reports, Oracle Graphics, and Procedure Builderplays in the development of a client-server application.
Page 328
Developer/2000 is a family of products that are used to design and build client-server applications. These applications can be deployed to the Windows, Mac, and UNIX Motif environments. In addition, you also can deploy character-mode versions of your applications. There are four principal components of Developer/2000:
This lesson focuses on the use of Oracle Forms.
Let's dive right into using Oracle Forms. This section guides you through the building of a form that will enable you to view and modify student information.
Before going any further, you should connect to the Oracle database.
To connect Forms Designer to an Oracle database, select File | Connect from the menu. A dialog box is displayed, prompting you for the username, password, and database to use for establishing an Oracle database connection. If you are using Personal Oracle for development, enter the following:
Username | flugle |
Password | flugle |
Database | Leave blank |
Page 329
Figure 12.1.If you're using an Oracle Server for development, enter, as shown in Figure 12.2, the following items:
Username | flugle |
Password | flugle |
Database | flugle (assuming that you already have used SQL*Net Easy Configuration to create a database alias named flugle that points to the Oracle database where you have loaded the sample tables) |
For both cases, click the Connect button. If there are no error messages, you can assume that you have successfully connected to the database.
Figure 12.2.Page 330
By default, Forms Designer opens a new form, named Module1, when it's first invoked. There are three elements that appear in almost all forms:
Continue building your simple form by creating a block. Oracle Forms uses a block to map fields in a form to columns in an Oracle table. From the menu, select Tools | New Block. A dialog window, entitled New Block Options, is displayed. There are four tabs on this window: General, Items, Layout, and Master/Detail. When the window is invoked, the General tab is displayed. Notice that the Base Table field contains <NONE> (see Figure 12.3).
Figure 12.3.To identify the Student table, press the Select button to the right of the Base Table field. The Forms Designer displays another window, which contains five checkboxes, to determine which database objects you should be able to choose from. By default, two checkboxes are selectedCurrent User and Tables (see Figure 12.4). Using these default values, click OK.
Figure 12.4.Page 331
The Forms Designer now displays a window which contains a list of the tables owned by flugle. Scroll down the list until you see the Student table. Select the table with the mouse and click OK (see Figure 12.5).
Figure 12.5.The Forms Designer now returns to the New Block Options window. However, now the Base Table field contains the table that you selectedStudent (see Figure 12.6).
Figure 12.6.Now look at two of the other tabs on the New Block Options window. Select the Items tab. At this point, the list box beneath the Select Columns button is empty. Click the Select Columns button. By default, all the columns in the selected table are included in the form (see Figure 12.7).
There are a few other things worth noting about the Items tab folder. If a column has a leading +, it will be included in the form; if it has a leading -, it won't be included. The label for each item is based on the column's name. An underscore in a column name is transformed into a space for that column's label. The initial character of each word in a column's label is capitalized. Each item also has a type. By default, each selected item is a Text Item.
Page 332
Figure 12.7.Now take a look at the layout of the new block. Select the Layout tab. There are two layout styles that can be specified from the list in the Style field, Tabular and Form; select Form. The Form style is used to display one record at a time. There also are two possible orientations for the new block; select Horizontal.
There are three checkboxes shown under Options. If checked, the Integrity Constraints checkbox generates the necessary triggers to enforce the table and column constraints that exist for this table. Select the Integrity Constraints checkbox. If checked, the Button Palette checkbox generates a group of buttons that can be used to navigate through the records in the form or modify the records displayed in the form. Select the Button Palette checkbox. Don't check the Scrollbar checkbox; because this block displays only one record at a time, there's no need for a scrollbar. Figure 12.8 shows what you should see in the Layout tab folder after you've made these selections.
Figure 12.8.For the time being, you can ignore the Master/Detail tab folder; you'll be using it in the next lesson. To create the new block, click OK. The Forms Designer returns you to the Object Navigator. However, you should now see two blocks displayed in the Object NavigatorStudent and Button_Palette (see Figure 12.9). You also should notice that there's a + to the