Calling Stored Procedures. Read Part 1, Part 2, and Part 3 of this series.
By Roger Sanders
Editor's Note: This article is excerpted from chapter 6 of QuickStart Guide to Db2 Development with Python, by Roger Sanders.
If an application has one or more transactions that perform a relatively large amount of work with little or no user interaction, those transactions can be encapsulated and stored on the database server as a stored procedure. Stored procedures make it possible to perform data processing operations directly at the server, which typically is a high-performant computer that can provide quick, coordinated data access. More importantly, because a stored procedure is invoked by a single SQL statement (or API/Cursor object method), fewer messages have to be transmitted across the network—only the data that is actually needed at the client has to be sent across the wire.