Updating fields with StoredProcedures

I´m using Interbase 6.0. I have an application in which everytime a customer buys something I have to update two tables. One is the Item table that I have to subtract the number of items the customer bought. And the other one is the Clients table that I have to Sum the total of it´s purchase. I want to make a StoredProcedure to do it for me. Does anyone have any examples ? And if it´s better doing it with StoredProcedure or with Querys ?

>What I want to do is have one StoredProcedure for each table.
It is possible to manage a table using only a StoredProcedure passing an additional parameter:
ALTER PROCEDURE PROC_ITEM_INSERT_UPDATE_DELETE

In your case it is better to use a stored procedure, because you will send parameters for updating once, then stored procedure will update 2 tables. If you use Query it will need to be executed 2 times with different SQL.Text (or 2 Queries executed each 1 time).
Another reason could be if needed some changes:
- If you use a stored procedure you must alter the database (sometimes it is difficult);
- If you use query you must to recompile the application with new features.
I think it is difficult to make decision about that.

What I want to do is have one StoredProcedure for each table. Do you think it will decrease traffic if I use the StoredProcedure to do the job ? Passing the value and the table name ?? Where am I going to get more ?

Stored procedures provide:
Modular design: stored procedures can be shared by applications that access the same database, eliminating duplicate code, and reducing the size of applications.
Streamlined maintenance: when a procedure is updated, the changes are automatically reflected in all applications that use it without the need to recompile and relink them. They are compiled and optimized only once for each client.
Improved performance: especially for remote client access. Stored procedures are executed by the server, not the client, which reduces network traffic.

Featured Post

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Objective:
- This article will help user in how to convert their numeric value become words.
How to use
1. You can copy this code in your Unit as function
2. than you can perform your function by type this code
The Code
(CODE)
The Im…

Creating an auto free TStringList
The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list.
In such cases, you have to…

Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…