Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How could I write a trigger to get the sum of values held in a different form?

User_6OSDLMar 30 2021 — edited Mar 30 2021

I'm new to PL/SQL and Oracle Form Builder so, pardon my ignorance. I have three relations DEBTOR, LIST and REGISTRATION. I have described these below:
DEPTOR- debtorID (PK) | firstname | surname | address | postcode
LIST- dCode (PK) | name | fee | description |
REGISTRATION- regID (PK) | debtorID* | dCode* | approvedBy
I have a non-database item called DEBT_FEE which display LIST.fee on my REGISTRATION form. I used a WHEN-NEW-ITEM-INSTANCE trigger to do this.

DECLARE
     V_FEE NUMBER(5, 2);
BEGIN
     SELECT FEE INTO V_FEE FROM LIST
     WHERE :REGISTRATION.DCODE = MODULE.DCODE;

     :DEBT_FEE:= V_FEE;
END;

I was wondering how I could do something similar to get the sum of all the debts the current debtor owes. Any help would be appreciated.

Comments

Post Details

Added on Mar 30 2021
6 comments
483 views