top of page

Group

Public·68 members
Axel Foster
Axel Foster

Oracle Forms 10g for Dummies: A Step-by-Step Tutorial with PDF Download



Oracle Forms 10g Tutorial For Beginners Pdf Download




If you are looking for a comprehensive and easy-to-follow guide on how to use Oracle Forms 10g, you have come to the right place. In this article, you will learn what Oracle Forms 10g is, why you should learn it, how to install it, how to create a simple form, how to use triggers and built-in functions, how to use PL/SQL, and how to use reports. By the end of this article, you will be able to create your own forms and reports using Oracle Forms 10g. You will also be able to download a PDF version of this tutorial for your convenience.




Oracle Forms 10g Tutorial For Beginners Pdf Download



What is Oracle Forms 10g?




Oracle Forms 10g is a software tool that allows you to create and deploy forms and reports for web-based applications. It is part of the Oracle Developer Suite 10g, which also includes other tools such as Oracle Reports, Oracle Designer, and Oracle JDeveloper. Oracle Forms 10g is based on the concept of data blocks, which are collections of items that correspond to fields in a database table or view. You can use Oracle Forms 10g to create user interfaces that interact with data stored in an Oracle database or other data sources.


Why learn Oracle Forms 10g?




Oracle Forms 10g is a powerful and versatile tool that can help you create web-based applications that are secure, scalable, and user-friendly. Some of the benefits of learning Oracle Forms 10g are:



  • You can create forms and reports quickly and easily using wizards and graphical tools.



  • You can use triggers and built-in functions to add logic and functionality to your forms and reports.



  • You can use PL/SQL, which is a procedural extension of SQL, to write complex code and queries for your forms and reports.



  • You can use reports to generate formatted output from your forms data.



  • You can deploy your forms and reports on any web browser without requiring any client-side installation.



Oracle Forms 10g is widely used in various industries and domains, such as banking, finance, education, health care, manufacturing, retail, and more. Learning Oracle Forms 10g can help you enhance your skills and career prospects as a web developer or database administrator.


How to install Oracle Forms 10g




Prerequisites




Before you can install Oracle Forms 10g, you need to have the following prerequisites:



  • A computer with Windows XP or later operating system.



  • An internet connection.



  • An Oracle database server (version 9i or later) or access to one.



  • A web server (such as Apache or IIS) or access to one.



  • At least 2 GB of free disk space.



  • At least 512 MB of RAM.



Downloading Oracle Forms 10g




To download Oracle Forms 10g, you need to visit the Oracle website and register for a free account. Then, you need to follow these steps:



  • Go to https://www.oracle.com/downloads/ and click on "Developer Tools".



  • Scroll down and click on "Oracle Developer Suite 10g (10.1.2.0.2)".



  • Select the appropriate platform (such as Windows) and click on "Download".



  • Accept the license agreement and enter your Oracle account credentials.



  • Download the file "ds_windows_x86_101202_disk1.zip" (about 1.1 GB) and save it to your computer.



  • Extract the zip file to a folder of your choice.



Installing Oracle Forms 10g




To install Oracle Forms 10g, you need to follow these steps:



  • Open the folder where you extracted the zip file and double-click on the file "setup.exe".



  • Select the language of your choice and click on "OK".



  • Click on "Next" on the welcome screen.



  • Select "Complete" as the installation type and click on "Next".



  • Enter a name and a path for the Oracle home directory and click on "Next".



  • Select the components you want to install (such as Forms Developer, Reports Developer, etc.) and click on "Next".



  • Enter the hostname, port number, SID, username, and password of your Oracle database server and click on "Next".



  • Enter the hostname, port number, username, and password of your web server and click on "Next".



  • Review the summary of the installation settings and click on "Install".



  • Wait for the installation to complete and click on "Finish".



Congratulations! You have successfully installed Oracle Forms 10g on your computer. You can now start creating forms and reports using Oracle Forms 10g.


How to create a simple form in Oracle Forms 10g




Creating a data block




A data block is a collection of items that correspond to fields in a database table or view. To create a data block, you need to follow these steps:



  • Open Oracle Forms 10g by clicking on "Start" > "All Programs" > "Oracle Developer Suite - 10g" > "Forms Developer" > "Forms Builder".



  • Select "File" > "New" > "Form" to create a new form.



  • Select "Data Block" in the Object Navigator and click on the "+" icon to create a new data block.



  • Select "Use the Data Block Wizard" and click on "OK".



  • Click on "Next" on the welcome screen.



  • Select "Table or View" as the type of data block and click on "Next".



  • Select your database connection and click on "Connect". Enter your username and password if prompted.



  • Select the table or view you want to use for your data block (such as EMPLOYEES) and click on "Next".



  • Select the columns you want to include in your data block (such as EMPLOYEE_ID, FIRST_NAME, LAST_NAME, etc.) and click on "Next".



  • Select "Yes" to include a primary key item in your data block and click on "Next".



  • Select "No" to create the data block as a single record block and click on "Next".



  • Select "No" to use default names for your items and click on "Next".



  • Rename your items as per your preference (such as Employee ID, First Name, Last Name, etc.) and click on "Next".



  • Select "Yes" to create labels for your items and click on "Next".



  • Rename your labels as per your preference (such as Employee ID, First Name, Last Name, etc.) and click on "Next".



  • Select the layout style for your data block (such as Form) and click on "Next".



Next".


  • Select the title for your data block (such as Employees) and click on "Next".



  • Review the summary of the data block settings and click on "Finish".



You have now created a data block for your form. You can see the data block and its items in the Object Navigator and the layout in the Layout Editor.


Creating a layout




A layout is a graphical representation of your data block. You can use the Layout Editor to modify the appearance and position of your items and labels. To create a layout, you need to follow these steps:



  • Select "Layout" in the Object Navigator and click on the "+" icon to create a new layout.



  • Select "Use the Layout Wizard" and click on "OK".



  • Click on "Next" on the welcome screen.



  • Select your data block (such as EMPLOYEES) and click on "Next".



  • Select the items you want to include in your layout (such as Employee ID, First Name, Last Name, etc.) and click on "Next".



  • Select the layout style for your layout (such as Form) and click on "Next".



  • Select the canvas type for your layout (such as Content Canvas) and click on "Next".



  • Select the title for your layout (such as Employees) and click on "Next".



  • Review the summary of the layout settings and click on "Finish".



You have now created a layout for your form. You can see the layout in the Layout Editor and modify it as per your preference. You can use tools such as alignment, resizing, moving, formatting, etc. to adjust your layout.


Running the form




To run your form, you need to follow these steps:



  • Select "Program" > "Run" or press F11 to run your form.



  • Enter your username and password if prompted.



  • Wait for your form to load in a web browser.



  • Navigate through your form using buttons such as Next Record, Previous Record, First Record, Last Record, etc.



  • Enter or modify data in your form as per your requirement.



  • Save or discard your changes using buttons such as Commit, Rollback, etc.



  • Exit your form using buttons such as Exit Form, Exit Application, etc.



You have now run your form and interacted with it. You can see how your form works and looks like in a web browser.


How to use triggers and built-in functions in Oracle Forms 10g




What are triggers and built-in functions?




Triggers are blocks of PL/SQL code that execute when a certain event occurs in your form. For example, when a user enters a value in an item, when a user navigates to a record, when a user saves changes, etc. You can use triggers to add logic and functionality to your form. For example, you can use triggers to validate data, perform calculations, display messages, call other forms or reports, etc.


Built-in functions are predefined functions that perform common tasks in your form. For example, getting or setting item values, navigating through records or blocks, executing queries or DML statements, displaying alerts or dialogs, etc. You can use built-in functions within triggers or other PL/SQL code to simplify your coding.


Types of triggers and built-in functions




There are different types of triggers and built-in functions in Oracle Forms 10g. Some of the common types are:



  • Form-level triggers: These triggers execute when a form-level event occurs. For example, when a form is opened or closed, when a form is initialized or terminated, etc. You can use form-level triggers to perform tasks that affect the whole form. For example, you can use a WHEN-NEW-FORM-INSTANCE trigger to initialize global variables or parameters when a form is opened.



  • Block-level triggers: These triggers execute when a block-level event occurs. For example, when a block is entered or exited, when a record is inserted or deleted, etc. You can use block-level triggers to perform tasks that affect a specific block. For example, you can use a WHEN-NEW-RECORD-INSTANCE trigger to populate default values for a new record in a block.



  • Item-level triggers: These triggers execute when an item-level event occurs. For example, when an item is entered or exited, when an item value is changed or validated, etc. You can use item-level triggers to perform tasks that affect a specific item. For example, you can use a WHEN-VALIDATE-ITEM trigger to check the validity of an item value and display an error message if invalid.



  • Key triggers: These triggers execute when a user presses a key or a combination of keys on the keyboard. For example, when a user presses F10, Ctrl+S, etc. You can use key triggers to perform tasks that are associated with keyboard shortcuts. For example, you can use a KEY-COMMIT trigger to save changes when a user presses Ctrl+S.



  • Mouse triggers: These triggers execute when a user clicks or double-clicks on an object with the mouse. For example, when a user clicks on a button, a radio button, a check box, etc. You can use mouse triggers to perform tasks that are associated with mouse actions. For example, you can use a WHEN-BUTTON-PRESSED trigger to call another form or report when a user clicks on a button.



  • Timer triggers: These triggers execute when a timer expires. A timer is an object that you can create and start in your form to perform a task after a specified interval of time. For example, you can create and start a timer to refresh data every 10 seconds. You can use timer triggers to perform tasks that are based on time intervals. For example, you can use a WHEN-TIMER-EXPIRED trigger to execute a query when a timer expires.



  • Built-in functions: These functions are predefined functions that perform common tasks in your form. There are different categories of built-in functions, such as item functions, block functions, form functions, record functions, navigation functions, query functions, DML functions, alert functions, dialog functions, etc. You can use built-in functions within triggers or other PL/SQL code to simplify your coding. For example, you can use the GET_ITEM_PROPERTY function to get the value of an item property, such as enabled or visible.



Examples of triggers and built-in functions




Here are some examples of how to use triggers and built-in functions in Oracle Forms 10g:



  • To display the current date and time in an item called DATE_TIME in your form, you can use the following code in the WHEN-NEW-FORM-INSTANCE trigger:



begin :DATE_TIME := SYSDATE; end;



  • To calculate the salary of an employee based on the hours worked and the hourly rate in your form, you can use the following code in the WHEN-VALIDATE-ITEM trigger of the HOURS_WORKED item:



begin :EMPLOYEES.SALARY := :EMPLOYEES.HOURS_WORKED * :EMPLOYEES.HOURLY_RATE; end;



  • To display an alert message asking the user to confirm before deleting a record in your form, you can use the following code in the KEY-DELREC trigger:



declare v_alert number; v_button number; begin v_alert := FIND_ALERT('CONFIRM_DELETE'); v_button := SHOW_ALERT(v_alert); if v_button = ALERT_BUTTON1 then DELETE_RECORD; end if; end;



  • To call another form called CUSTOMERS.FMX from your form, you can use the following code in the WHEN-BUTTON-PRESSED trigger of a button called CALL_CUSTOMERS:



begin CALL_FORM('CUSTOMERS.FMX'); end;



  • To create and start a timer called REFRESH_TIMER that expires every 10 seconds and executes a query in your form, you can use the following code in the WHEN-NEW-FORM-INSTANCE trigger:



declare v_timer TIMER; begin v_timer := CREATE_TIMER('REFRESH_TIMER',10000,REPEAT); end;



  • To execute a query when the timer expires, you can use the following code in the WHEN-TIMER-EXPIRED trigger:



begin if GET_APPLICATION_PROPERTY(TIMER_NAME) = 'REFRESH_TIMER' then EXECUTE_QUERY; end if; end;


How to use PL/SQL in Oracle Forms 10g




What is PL/SQL?




PL/SQL is a procedural extension of SQL that allows you to write complex code and queries for your forms and reports. PL/SQL stands for Procedural Language/Structured Query Language. PL/SQL supports features such as variables, constants, data types, operators, expressions, control structures, loops, cursors, exceptions, subprograms, packages, etc. You can use PL/SQL to perform tasks that are not possible or efficient with SQL alone. For example, you can use PL/SQL to manipulate data, validate input, perform calculations, handle errors, etc.


How to write PL/SQL code in Oracle Forms 10g




You can write PL/SQL code in Oracle Forms 10g using the PL/SQL Editor. The PL/SQL Editor is a tool that allows you to create and edit PL/SQL code in your form. You can access the PL/SQL Editor by selecting an object (such as a trigger or a program unit) in the Object Navigator and clicking on the "PL/SQL Editor" icon or pressing F4. You can also access the PL/SQL Editor by selecting "Tools" > "PL/SQL Editor" from the menu bar.


The PL/SQL Editor has two panes: the Code pane and the Declaration pane. The Code pane is where you write your PL/SQL code. The Declaration pane is where you declare your variables, constants, cursors, exceptions, etc. You can use the Declaration pane to create and edit declarations without affecting the Code pane. You can also use the Declaration pane to view the declarations of built-in packages and subprograms.


The PL/SQL Editor has various features that help you write and debug your PL/SQL code. Some of these features are:



  • Syntax highlighting: The PL/SQL Editor highlights different elements of your code with different colors and fonts to improve readability and clarity.



  • Code completion: The PL/SQL Editor suggests possible keywords, identifiers, and parameters as you type your code. You can use the arrow keys and the Enter key to select a suggestion.



  • Code templates: The PL/SQL Editor provides predefined templates for common code structures such as loops, if-then-else statements, exception handlers, etc. You can use the Ctrl+Space key combination to insert a template.



  • Code formatting: The PL/SQL Editor formats your code according to predefined rules and standards. You can use the Ctrl+F7 key combination to format your code.



  • Code navigation: The PL/SQL Editor allows you to navigate through your code using various tools such as bookmarks, outlines, hyperlinks, etc. You can use these tools to jump to different parts of your code or to other objects in your form.



  • Code debugging: The PL/SQL Editor allows you to debug your code using various tools such as breakpoints, watches, variables, call stack, etc. You can use these tools to monitor and modify the execution of your code.



Examples of PL/SQL code in Oracle Forms 10g




Here are some examples of how to write PL/SQL code in Oracle Forms 10g:



  • To declare a variable called v_name of type VARCHAR2(20) and assign it the value 'John', you can use the following code in the Declaration pane:



declare v_name VARCHAR2(20) := 'John';



  • To display a message with the value of v_name using an alert called MESSAGE_ALERT, you can use the following code in the Code pane:



begin SET_ALERT_PROPERTY('MESSAGE_ALERT',ALERT_MESSAGE_TEXT,'Hello 'v_name); SHOW_ALERT('MESSAGE_ALERT'); end;



  • To create a cursor called c_employees that selects all employees from the EMPLOYEES table and loop through it using a FOR loop, you can use the following code in the Code pane:



declare cursor c_employees is select * from EMPLOYEES; begin for r_employee in c_employees loop -- do something with r_employee end loop; end;



  • To create a subprogram called add_numbers that takes two numbers as parameters and returns their sum, you can use the following code in the Code pane:



declare function add_numbers(p_num1 number, p_num2 number) return number is v_sum number; begin v_sum := p_num1 + p_num2; return v_sum; end; begin -- call the subprogram dbms_output.put_line('The sum is 'add_numbers(10,20)); end;


How to use reports in Oracle Forms 10g




What are reports?




Reports are formatted output that display data from your forms or other sources. You can use reports to present data in a clear and attractive way. For example, you can use reports to generate invoices, receipts, statements, charts, graphs, etc. You can also use reports to print, export, or email your data.


How to create reports in Oracle Forms 10g




To create reports in Oracle Forms 10g, you need to use Oracle Reports 10g, which is another tool in the Oracle Developer Suite 10g. Oracle Reports 10g allows you to design and generate reports using wizards and graphical tools. To create reports in Oracle Reports 10g, you need to follow these steps:



  • Open Oracle Reports 10g by clicking on "Start" > "All Programs" > "Oracle Developer Suite - 10g" > "Reports Developer" > "Reports Builder".



  • Select "File" > "New" > "Report" to create a new report.





About

Welcome to the group! You can connect with other members, ge...

Members

bottom of page