Who is Studds?
Below is a very very basic Stored procedure. All it does is accept
from the caller and
insert a row into a table using the data from this parm.
There are lots of things missing: debugging code, error handling,
communication to the caller....
But it works.
Here is code that could call it:
I'm a tad puzzled why you say you have to write a Stored Procedure
ask what is the advantage of using a Stored Procedure. What is the
problem your S.P. will solve? Stored procedures have lots of
Here are a few excerpts from an excellent Redbook:
Getting Started with DB2 Stored Procedures:
Give Them a Call through the Network >> SG24-4693-01
(C) Copyright International Business Machines Corporation 1996
"Stored procedures enable you to encapsulate many of your
application¢ s SQL
statements into a
program that is stored at the DB2 server. The client can invoke the
procedure by using only one
SQL statement, thus reducing the network traffic to a single send
receive operation for a series of
SQL statements. It is also easier to manage and maintain programs
at the server than it is to
manage and maintain many copies at the client machines.
Stored procedures enable you to split the application logic between
client and the server. You can
use this technique to prevent the client application from
contents of sensitive server
data. You can also use it to encapsulate business logic into
programs at the
server. Figure 2 on
page 3 shows an example of the processing for a client/server
with stored procedures.
Stored procedures also enable access to features that exist only on
database server. These
features include commands that run only on the server, software
only on the server that can
be accessed by the stored procedure, and the computing resources of
server, such as memory and
Because stored procedures are defined in DRDA, they also take
DRDA features, such as
data transformation between platforms, database security and
There are other great Stored Procedure Redbooks. See
77 FILLER PIC X(12) VALUE 'SPISRT WS:'.
EXEC SQL INCLUDE SQLCA END-EXEC.
49 IN-TEXT-L PIC S9(4) COMP.
49 IN-TEXT-D PIC X(03).
PROCEDURE DIVISION USING IN-TEXT.
EXEC SQL INSERT INTO SPINSERT (TEXT)
Hope this answers a few questions and helps a bit.
Compuware Corporation File-AID Product Architect
[login to unmask email]