Enterprise Edition Home | Express Edition Home | Previous Page | Next Page   SQL Statements > PREPARE >

Restrictions

The number of prepared objects in a single program is limited by available memory. These include statement identifiers declared in PREPARE statements (statement_id or statement_id_var) and declared cursors. To avoid exceeding the limit, use the FREE statement to release some statements or cursors.

The maximum length of a PREPARE statement is 64 kilobytes.

For restrictions on the statements in the character string, see Restricted Statements in Single-Statement Prepares and Restricted Statements in Multistatement Prepared Objects.

Using a Statement Identifier

PREPARE sends the statement text to the database server, which analyzes the statement text. If the text contains no syntax errors, the database server translates it to an internal form. This translated statement is saved for later execution in a data structure that the PREPARE statement allocates. The name of the structure is the value that is assigned to the statement identifier in the PREPARE statement. Subsequent SQL statements can refer to the structure by using the same statement identifier that was used in the PREPARE statement.

A subsequent FREE statement releases the database server resources that were allocated to the statement. After you release these resources with FREE, you cannot use the statement identifier in a DECLARE statement or with the EXECUTE statement until you prepare the statement again.

Enterprise Edition Home | Express Edition Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]