Welcome to Scribd. Sign in or start your free trial to enjoy unlimited e-books, audiobooks & documents.Find out more
Download
Standard view
Full view
of .
Look up keyword
Like this
3Activity
0 of .
Results for:
No results containing your search query
P. 1
db2cert7037-a4

db2cert7037-a4

Ratings: (0)|Views: 110|Likes:
Published by jeeboomba
Chapter 7 :DB2 UDB V8.1 Family Application Development
Certification:
Chapter 7 :DB2 UDB V8.1 Family Application Development
Certification:

More info:

Published by: jeeboomba on Sep 23, 2008
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

05/09/2014

pdf

text

original

 
DB2 UDB V8.1 Family Application DevelopmentCertification:User-defined routines
Get ready for the exam
Skill Level: IntroductoryDrew Bradstock(drewkb@ca.ibm.com) Engagement Manager08 Apr 2004In this tutorial, you'll learn about using user-defined routines with the DB2 UniversalDatabase. You'll see how you can utilize programming logic within DB2 to simplifyand speed up your applications. This is the last tutorial in a series of seven that youcan use to help prepare for the DB2 UDB V8.1 Family Application DevelopmentCertification exam (Exam 703).
Section 1. Before you start
What is this tutorial about?
In this tutorial, you'll learn about using user-defined routines with the DB2 UniversalDatabase. You'll see how you can utilize programming logic within DB2 to simplifyand speed up your applications. We'll discuss the following topics:User-defined functions and how to use themStored proceduresThe DB2 Development Center toolThis is the seventh in a series of seven tutorials that you can use to help prepare forthe DB2 UDB V8.1 Family Application Development Certification exam (Exam 703).The material in this tutorial primarily covers the objectives in Section 7 of the exam,entitled "User-defined routines." You can view these objectives at:http://www.ibm.com/certify/tests/obj703.shtml.
 
You do not need a copy of DB2 Universal Database to complete this tutorial.However, you can download a free trial version of IBM DB2 Universal Database fromthedeveloperWorks downloads sitefor reference.
Who should take this tutorial?
To take the DB2 UDB V8.1 Family Application Development exam, you must havealready passed the DB2 UDB V8.1 Family Fundamentals exam (Exam 700). Youcan use the DB2 Family Fundamentals tutorial series (seeResources) to prepare forthat test. It is a very popular tutorial series that has helped many people understandthe fundamentals of the DB2 family of products.This tutorial is one of the tools that can help you prepare for Exam 703. You shouldalso reviewResourcesat the end of this tutorial for more information.This tutorial is designed to help you study for the user-defined routines section of theDB2 Family Application Development exam. For this tutorial to be useful, you shouldhave a solid understanding of how SQL is used and how it works with a database.An understanding of programming methodologies and flow of control usage wouldalso help. You should also have a base knowledge of:DatabasesDatabase objectsApplication compilation
Terminology review
Before you begin this tutorial, you need to be familiar with the concept of an
SQLaccess plan 
. This is a set of steps the DB2 engine uses to execute an SQLstatement. It includes the indexes that are used, the times at which fields areretrieved from the database tables, and the order in which the steps of the query areexecuted. The access plan is created by a database engine based on an SQLstatement sent to that engine.We'll be using the term throughout this tutorial, so it's important to make sure youunderstand it up front.
Notices and trademarks
Copyright, 2004 International Business Machines Corporation. All rights reserved.IBM, DB2, DB2 Universal Database, DB2 Information Integrator, WebSphere andWebSphere MQ are trademarks or registered trademarks of IBM Corporation in theUnited States, other countries, or both.
developerWorks® ibm.com/developerWorksUser-defined routinesPage 2 of 47© Copyright IBM Corporation 1994, 2007. All rights reserved.
 
Other company, product, and service names may be trademarks or service marks ofothers.
Section 2. Using user-defined functions
What are user-defined functions?
User-defined functions 
, or UDFs as they are commonly known, are functions definedby the user aaqqthat run in the database engine. The functions are used to simplifythe logic within SQL statements. Instead of repeatedly including common or complexlogic in multiple statements, the developer can isolate that logic in a single function.Traditionally, people think of a function as a program that takes in some inputs andthen returns a result. Within a database, you have a great deal more flexibility andpossibilities in what you can do with a function. There are a number of different typesof functions, and also different languages you can write them in.Here are the types of available functions:
SQL Scalar
: Returns a single data type value using SQL
SQL Row
: Returns a row of data using SQL
SQL Table
: Returns an SQL table based on SQL
External Scalar
: Returns a single data type using an external language
Sourced
or
Template
: Are based on another function or templateAnd here are the programming languages that you can write them in:SQL (for functions written using one or more SQL statements)C/C++The Java languageSQLJVisual Basic
Function types
There are two distinct types of functions. The more common type is an
internal function 
, which is a function written using SQL statements. Functions can also bewritten as references to external components of code, be they in the Java language,
ibm.com/developerWorks developerWorks® User-defined routines © Copyright IBM Corporation 1994, 2007. All rights reserved.Page 3 of 47

Activity (3)

You've already reviewed this. Edit your review.
1 thousand reads
1 hundred reads
mubarak_y2k2 liked this

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->