0% found this document useful (0 votes)
322 views

DB2 Stored Procedure Introduction

This document discusses DB2 stored procedures. It defines a stored procedure as an executable program under the control of the DB2 server that is invoked via the SQL CALL statement. It may contain business logic, parameters, and result sets. Stored procedures should be used when performance is important, there are many clients, applications involve heavy database activity but little user interaction, client code changes frequently, or client access needs control. The document reviews considerations for using stored procedures like determining the client portion, programming language, defining and coding the procedure. It provides an overview of client/server application flow and design tips for stored procedures.

Uploaded by

RIDA ERLANGGA
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
322 views

DB2 Stored Procedure Introduction

This document discusses DB2 stored procedures. It defines a stored procedure as an executable program under the control of the DB2 server that is invoked via the SQL CALL statement. It may contain business logic, parameters, and result sets. Stored procedures should be used when performance is important, there are many clients, applications involve heavy database activity but little user interaction, client code changes frequently, or client access needs control. The document reviews considerations for using stored procedures like determining the client portion, programming language, defining and coding the procedure. It provides an overview of client/server application flow and design tips for stored procedures.

Uploaded by

RIDA ERLANGGA
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 11

PEMROGRAMAN BASIS

DATA
PERKULIAHAN
 PENILAIAN
 TUGAS : 20%
 QUIS : 10%
 UTS : 10%
 UAS/PROJECT : 20%
 UJIAN KODING : 20 %
 PRAKTIKUM : 20%
 NILAI KELAS : PENAMBAHAN DI AKHIR
 MATERI
 SERTIFIKASI
 0821 393 55551 & 085 755 064 091
[email protected] &
[email protected]
 ftp:\\172.21.0.120
DB2 STORED PROCEDURE
INTRODUCTION
UNIT OBJECTIVES
After completing this unit, you should be able to:
 Describe a stored procedure

 Determine when a stored procedure should be


used
 Describe execution flow using stored procedures

 List DB2 stored procedure design and general


tips
WHAT IS A STORED PROCEDURE?
A Stored Procedure:
 Is an executable program under control of the
DB2 server
 Is invoked via the SQL CALL statement

 May contain business logic

 May be invoked locally or remotely

 May receive or pass parameters

 May produce result sets


WHEN TO USE A STORED PROCEDURE
Stored procedures may be justified when:
 The application's performance expectations are
not being met
 There are a large number of clients to which
application code is distributed.
 The client application generates relatively heavy
database activity, but involves little user
interaction.
 The client application code changes frequently.
 The access to the client application code needs to
be controlled.
 The client application executes many SQL
statements.
CONSIDERATIONS WHEN USING STORED
PROCEDURES

Stored procedures are incorporated by:


 Determining client portion of application

 Thin client?

 Selecting stored procedure server

 Developing stored procedure

 Determining calling parameters

 Selecting programming language / SQL PL, PL


SQL / IBM DB2 Data Studio Developer / CLP,
Command Editor, Text Editor
 Defining SP to server

 Coding and testing


APPLICATION FLOW
CLIENT/SERVER: THE BIG PICTURE
SERVER PROCEDURE: DESIGN/GENERAL
TIPS

 Consider the cost of invoking a stored procedure


versus the cost of network transmission for a
distributed application.
 Stored procedures run in background.–Do not use
the standard I/O streams
 No commands to terminate current process.

 Overloading stored procedures restricted to


parameter subsets.
 SQL limited by stored procedure CREATE
parameters.
UNIT SUMMARY
 Describe a stored procedure
 Determine when a stored procedure should be
used
 Describe execution flow using stored procedures

 List DB2 stored procedure design and general


tips

You might also like