Contents
Oracle- Forms - PL/SQL
Database
Orders and Tables
PL/SQL
Oracle- Forms
© The scientific sentence. 2010
|
PL/SQL Running form using
Running form using PL/SQL
1. Running form using PL/SQL
Now, we are going to build and a form and running it that will
list one record of the the following tables:
table customer (customer_name, customer_street, customer_city)
table claim (claim_number, branch_name, amount)
table debit (customer_name, claim_number)
Plus, the form will contain a button once pressed will pop up window
that allow to check the claim's table attributes and fill in related
box. The code corresponding to the button will be written in PL/SQL.
1 Create the form as in chapter 4 with just one row,
make a join "customer. customer_name = debit.customer_name" and
the join "debit.claim_number = claim.claim_number",
Do not include the "amount" attribute to be displayed (it can be
deleted from the from if selected and deleted)
2. In the claim_form part, Create a display item for the branch_name box,
3 Right-click, with Property Palette, set
In Database Section: Database Item: No
In General Section: Name: C_NAME
4. Choose LOVs on Object Navigator, and start LOV Wizard: Tools >LOV Wizard,
5. Choose "New Record Group based on a query",
6 The future pop up will list all the attributes of the "claim" relation:
Write this query:
SELECT ALL CLAIM.CLAIM_NUMBER, CLAIM.BRANCH_NAME, CLAIM.AMOUNT
FROM CLAIM
ORDER BY CLAIM.AMOUNT
7. In the wizard LOC screen, choose all the claim's table attributes,
8 In the screen of "Look up return item...",
click on return value of branche_name and assign for it branch.branch_name,
click on return value of claim_number and assign for it debit.claim_number, and
click on return value of amount and assign for it C_NAME,
9. Add a title claim_form, retreive 20 items , Press next,
10. Assign amount (the one attribute to be displaced to right),
This will finish the wizard window.
10. With Property Palette, rename the LOVs:
On the Object Navigator window: claim_lov,
On Record Groups: claim_rec
11. Active the "branch_name" box. With Property Palette, assign for
"Validate from List": Yes
11. To create a button, from the palette. With Paqlette Property
set for it the name "claim_but"
12. Right click and choose PL/SQL Editor,
13. Select the trigger: "WHEN-BUTTON-PRESSED",
14. Within the PL/SQL editor, to display the claim_lov (i.e.: all
th attributes of the claim_relation); write this code:
DECLARE a_value BOOLEAN;
BEGIN
a_value:=Show_lov('claim_lov');
END;
1 Press the Compile button to check the code,
16. Close the Window.
Run the form created:
|
|
|