O'Reilly logo

DB2® SQL PL: Essential Guide for DB2® UDB on Linux™, UNIX®, Windows®, i5/OS™, and z/OS®, Second Edition by Paul Yip, Fraser McArthur, Michael Gao, Raul Chong, Drew Bradstock, Clara Liu, Zamil Janmohamed

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 2. Basic SQL Procedure Structure

In this chapter, you will learn

  • The fundamental structure of an SQL procedure

  • The various clauses for the CREATE PROCEDURE statement

  • The structure of the procedure body

  • The statements that can be coded in the procedure body

Stored procedures are used to encapsulate multiple SQL statements with flow logic. They are database objects that serve as sub-routines to applications. SQL procedures are defined in a database using the CREATE PROCEDURE statement. This chapter introduces the syntax of the CREATE PROCEDURE statement and uses examples to illustrate how to create simple SQL procedures.

The CREATE PROCEDURE Statement

The CREATE PROCEDURE statement defines a procedure in the database. The clauses define the name ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required