1. Introduction
- Oracle Forms is a software product for creating screens that interact with an Oracle database. It has an IDEincluding an object navigator, property sheet and code editor that uses PL/SQL .
- The primary focus of Forms is to create data entry systems that access an Oracle Database.
Developer Tools:
Oracle Developer contains 3 main components:
- Oracle Forms – For designing data entry forms.
- Oracle Reports – For designing reports.
- Oracle Graphics – For designing graphics such as charts that can be added to forms or reports.
Additional components include:
- Procedure Builder – An integrated development environment to write and debug stored procedures (program units) for use in the Oracle database or in any of the Developer tools.
- Query Builder – A GUI based query builder tool. Queries can be stored in the data dictionary or in a file system for later use and sharing.
- Schema Builder – A GUI tool for creating and modifying tables, views and constraints.
- Translation Builder – A tool for creating foreign language versions of applications written in Developer.
- Project Builder – A software development project management system that manages source code for all Developer components.
- PECS – The Oracle Performance Evaluation/Collection System – For profiling the execution and performance of applications developed with Oracle tools.
- Discoverer – A data browsing tool that can be customized for end-users.
This tutorial covers the Developer Forms, Reports and Graphics components and gives a brief introduction to the Schema Builder and Procedure Builder tools.
The Oracle Forms Designer Main Screen:
Once the appropriate menu item has been clicked on (for Windows 95/98/NT/2000), the Oracle Forms Builder Welcome Screen will appear:
Main Menu for Oracle Forms
Forms 6.0 displays this welcome screen as a quick way to start working and designing forms. For this tutorial, we will work directly from the Object Navigator since this is this most general way to work with forms.
To continue to the Object Navigator from the Welcome screen, click on the Cancel button or select the “Build a form Manually” option and click OK. In either case, the Object Navigator will appear.
Oracle Forms Object Navigator:
After starting up Oracle Forms, the main screen will be presented.
Object Navigator Panel
This screen is called the Object Navigator and displays all of the form elements, data blocks, menu items, user defined code libraries, built in procedures and functions, and database objects (tables, views). The display is in the form of a collapsible tree. In general, clicking on a + will expand the current item to show its details. Clicking on a – will collapse the current list details.
The menu bar across the top provides access to almost all of the features of Oracle Forms.
- The File menu has options to create, open, save and print forms. This menu also includes an option to connect to the database and the Administration option that is used to compile forms and menu code. The last option on the File menu is the Exit option that will exit Oracle Forms Builder.
- The Edit menu has options to cut, copy and paste objects, to invoke an editor and to undo an operation.
- The View menu toggles the object navigator display between visual elements and ownership elements.
- The Navigator menu has items that control the display of the object navigator including expanding and collapsing tree branches. The Navigator menu can also be used to create and delete objects using the Create and Delete menu options respectively.
- The Program menu has items that control form compilation, generation and execution (Run). Triggers, Procedures and other PL/SQL code can also be created from this menu. The Smart Triggers menu option displays the most commonly used triggers according to the type of object currently selected in the object navigator.
- The Tools menu has options to switch between several different screens including the Layout editor, Menu editor and Object Navigator. There are also several wizards that can be launched from this menu including the Data Block wizard, the Layout wizard, the Chart wizard and the LOV (List of Values) wizard.
- The Windows menu displays menu items for each of the windows you have open. By default, only one item – the Object Navigator – is displayed.
- Finally, the Help menu can be used to display help topics.
By default, a button bar is provided on the left hand side of the Object Navigator window. Each button duplicates some functionality on the menus. For example, clicking on the top icon (an opened folder) is the same as pulling down the File menu and choosing the Open option. To see what a button might do if pressed, place the mouse cursor over the button and a short message will appear describing the button’s function.
In Developer 6.0, a form, report or graphic is generally referred to as a Module. When first starting the Forms Builder, a default module is created called: MODULE1
The content of the Object Navigator is broken down into 6 major sections:
- Forms – Contains form objects and all of their sub-objects such as data blocks, triggers, alerts, canvases, program units (procedures and functions), parameters and windows. More than one form can be open at a time.
- Menus – Contains menu objects and all of their sub-objects such as menu items, parameters and program units. More than one menu can be open at a time.
- PL/SQL Libraries – These are libraries of PL/SQL code (stored either in the database or in .plb files). Libraries can be shared among different forms and among different developers.
- Object Libraries – These are libraries containing a collection of objects (anything that can appear on a form).
- Built-in Packages – Lists all of the packages (PL/SQL procedures) available by default to all forms, reports, etc.
- Database Objects – Lists all of the database objects (Tables, Views, PL/SQL Libraries, and Stored Program Units) in the user’s Oracle database schema.
As objects are created, they are displayed under the appropriate section. Context sensitive menus can be displayed for each object by clicking on an object with the right mouse button.
Connecting to the Database:
Database Connectivity is the important one :
- Fetch data from Database.
- Stores the data into database.
First thing, we want to go the folder path : C:\dev6i\NET80\ADMIN\TNSNAMES.ORA
we need to edit in the
mohan=
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS =
(PROTOCOL = TCP)
(Host = localhost)
(Port = 1521)
)
)
(CONNECT_DATA = (SID = xe)
)
)
we need to write the above code in TNSNAMES.ORA folder. In the above i gave the database name as ‘mohan’ then in ‘Host=local host’ because i connect the database with in my system,if we need to connect database from other system means we need to give ip address for that machine eg:‘Host=192.168.0.8’ then we need to save this file.
Then we go to Oracle sql developer and create a new connection.The screen is given below
- Screen shot for create a new connection in oracle 10g database
After create a connection, Under this connection we create table, insert data into table,procedure,trigger,views etc.
how to configure database in Oracle forms?
Press ctrl+j (or) Go to File Menu–>click connect—>one dialog box will appear
- Dialog box for Database connection in oracle Form
whatever we gave user name and password during creation of database connection in oracle database(see previous screen shot) that username and password we want to give in this dialog box., then database name is mohan
we want to go the folder path : C:\dev6i\NET80\ADMIN\TNSNAMES.ORA
we gave mohan as a database name
mohan=
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS =
(PROTOCOL = TCP)
(Host = localhost)
(Port = 1521)
)
)
(CONNECT_DATA = (SID = xe)
)
)
Forms Design:
In Oracle Forms, a form (or data entry form) acts like a window into the database schema. An individual focuses the attention of the user to one or a few of the tables at a time. In addition, a form can give prompts so the user knows what kind of input is expected and how data is to be entered and manipulated.
By default, every form in Oracle Forms has the capability to query existing data in a table, modify existing data and add new data (records) to the table. A form is built up using one or more data blocks that correspond to tables in the database. Fields within the data block correspond to columns in the database table.
First we going to create a table
Table name:TAB1
create table tab1(empno int,name varchar2(20))
THEN insert the values into the table
insert into tab2 values(111,’aa’)
insert into tab2 values(222,’bb’)
insert into tab2 values(333,’cc’)
insert into tab2 values(444,’ss’)
insert into tab2 values(555,’rr’)
Creating and Running a Form:
In this section, the basic steps for creating a basic data entry and query form for a single database table will be covered.
In general, a Data Block on a form corresponds to a table in the database. This is called the Base Table for the data block. For each table displayed on the form, a new data block will be created. For this example, only one data block will be created for the TAB1 table.
A block appears on a Canvas which is contained in a Window. There are many options to control multiple canvas views and multiple windows per form. In these examples, we concentrate on a simple arrangement using a single canvas and a single window.
There are a number of ways to create a data block. One way is to manually define the base table and columns, and their positions on the form. While this is possible, it can be very tedious.
Oracle Forms 6.0 provides two wizards (programs that guide the developer in performing common tasks) to create data blocks:
1. The Data Block wizard guides the developer through the steps of choosing a base table and columns.
2. The Layout wizard guides the developer through arranging the base table and columns on the form.
Creating a New Block:
To create a new block, pull down the Tools menu and select the Data Block wizard menu item. The following dialog box will appear:
Data Block welcome page
Click on the Next button. The following dialog box will appear:
Form views
There are two types of data blocks that can be created. Table/View and Procedures. For this example, choose Table/View and click on the Next button.
The next step is to choose a base table and columns that will belong to the data block. The following dialog box should appear:
Adding columns
To associate a database table with the block, click on the Browse... button to the right of the Table or View field. The following dialog box will pop up.
select items
Drag the columns to add
In this example, we want to continue on to the Layout wizard in order to specify how the new form will appear. Make sure the Create the block, then call the Layout wizard option is selected and click on the Finish button.
The data block will be created (as can be seen in the Object Navigator in the background). The objects created include the TAB1 data block containing items for each of the columns that were selected in the third step of the wizard.
Once the new data block and items are created, the first dialog box in the Layout wizard will appear:
Layout Wizard
Click on the Next button and the following dialog box will appear:
The layout for a data block may be placed on any existing canvas. In this case, there are no canvases so the only option available is to create a new canvas.
Click on the Next button to display the following dialog box:
In this dialog box, the field labels, field sizes and field heights can be altered. Change the field labels as below and click on the Next button:
Display in Form
There are two main styles for forms. A Tabular layout arranges the field labels across the top of the form with a number of records below as in a spreadsheet.
A Form layout places the field labels to the left of the fields. Generally only one record is displayed at a time.
For this example, choose a Form layout and click on the Next button.
In the following dialog box, type a title for the frame (around the data block) and check the option to include a scroll bar.
NOTES: The number of records displayed for a Form layout should be 1. The number of records displayed in a Tabular layout can be more than 1.
Display 5 rows in the form
Output for this process
Click Run,then it will afterwards click query button in the menu bar then click Execute..Then it will displayed