I have already described in my previous posts about creating oracle forms using wizards and creating list of values (LOVs). In this post I am going to discuss on the steps to Insert, Navigate and Delete records in oracle forms. Insertion, Deletion and Navigation functions are necessary for manipulating data within forms whether it is greed line view or form view or any other format. You can add those buttons by simply adding push buttons from toolbox to the form and adding PL/SQL query in the button trigger using PL/SQL editor. Here are some steps for adding buttons on the form.
Steps to Insert, Navigate and Delete Records in Oracle Forms
1. At first create a form as given in the post “How to Create Oracle Forms by Using Wizard ?” then start to add the buttons on the form as given in the image below.
2. Add push buttons in the form area from toolbox by clicking on it and drawing on the form. Then give a new name and label name as given in the image below from the Property Palette. You can open the Property Palette by right clicking on the button and clicking on Property Palette option.
3. After renaming and labeling the buttons, go to Object Navigator and expand the button name by clicking on the plus sign, then click on Triggers option and click on + sign above to add new trigger. Find and select “WHEN-BUTTON-PRESSED” option and click on OK.
4. A new PL/SQL editor window will appear as given below. Type the required query, save it and exit from the window. Repeat the same process for all the buttons you have created. The query commit; given in the image below is for saving records in the database.
5. Add the following PL/SQL queries in the PL/SQL editor for respected buttons.
- Show Record: execute_query;
- Previous Record: previous_record;
- Next Record: next_record;
- First Record: first_record;
- Last Record: last_record;
- Insert Record: create_query;
- Condition: enter_query;
- Save: commit;
- Delete: delete_record;
- Exit Form: exit_form;
6. After completing all the steps, run that form and test the buttons whether or not they are working.
Comments are closed.