Databases Reference
In-Depth Information
3-8. Running a PL/SQL Process when Saving the Page
Problem
Upon submitting a form, you want to save some of the data entered through the form in a separate table.
For example, you have a Patient Discharge form. When you create a record in this form, you need to
create a corresponding entry in the Payment History form.
Solution
To run a PL/SQL process when saving the page, follow these steps:
1.
Create the sample tables in Recipe 3-1.
2.
Create a new database application/standard data entry form over the
PATIENTDISCHARGE table.
3.
In the Page Definition
Page Processing area of the Patient Discharge form,
right click on the
Processes
node under the Processing node, and choose the
Create menu item.
In the first step of the wizard, choose the
PL/SQL
item.
4.
5.
Specify the name of the process in the next page of the wizard, and select On
Submit - After Computations and Validations for the Point field.
6.
In the next page, specify the PL/SQL shown in Listing 3-11. You should now
have the screen shown in Figure 3-25.
Listing 3-11.
Inserting Data into Another Table
INSERT INTO PAYMENTHISTORY(SOCIALSECURITYNO,AMOUNTPAID) VALUES (:P1_PATIENTSOCIALSECURITYNO,0)