use sored procedure
Posted by: RADE MIH
Date: February 07, 2018 07:19AM
apologize for my English, I'm a beginner ..
To simplify it is to insert or update in table1 of table2 and table3. If table 1 does not provide an account then insertconto and the amount, if there is an account then update the previous amount = the previous amount + amount.
If there is no account in the table2, the partner and the item then insert the account, the parner, the item and the amount if there are then update the previous amount = the previous amount - the amount.
In table3, if there is no account, partner, item then insert account, partner, item and amount, but if there are then only update amount, if the previous amount> 0 then the previous amount = the previous amount + amount, otherwise the previous amount = the previous amount - the amount.
table1 has account (primary key), amount.
table2 has an account, a partner, an item, an amount. account, partner, item are primary keys.
abela3 has an account, a partner, an item, an amount. account, partner, item are primary keys.
In the form I accept wkonto, wpartner, wstavka, wiznos corresponding to the names in the database I just added w to know that it is entered through the form.
I would like to put all this into a procedure that would involve commit and rolback, I think it would work so fast and safer this way.