September 8, 2010, Wednesday, 250


PREPARE

From SQL PL Guide for DB2

Jump to: navigation, search

PREPARE statement

The PREPARE statement is performing just the prepare of a dynamic statement. That means an executable statement (prepared statement) will be generated. The SQL statement is stored in a varchar variable. In contrast to the EXECUTE IMMEDIATE statement the prepare statement will be used when you're executing a statement multiple times. For executing the prepared statement there's the EXECUTE statement available.

Syntax:

PREPARE <sql-statement> [OUTPUT] INTO <result> [INPUT INTO] <input> FROM <variable>


Example:

...comming soon...

Link to the DB2 Information Center: DB2 9 DB2 9.5