Skip to main content
Version: 1.0.16

EXECUTE

EXECUTE — Execute a prepared statement

Synopsis

EXECUTE name [ ( parameter [, ...] ) ]

Description

EXECUTE is used to execute a previously prepared statement. Since prepared statements only exist for the duration of a session, the prepared statement must have been created by an earlier PREPARE statement executed in the current session.

If the PREPARE statement that created the prepared statement specified some parameters, a compatible set of parameters must be passed to the EXECUTE statement, otherwise an error will occur. Note that (unlike functions) prepared statements cannot be overloaded based on the type or number of their parameters. Within a database session, the name of a prepared statement must be unique.

For more information on creating and using prepared statements, see PREPARE.

Parameters

name

The name of the prepared statement to execute.

parameter

The actual value of a parameter to the prepared statement. This must be an expression yielding a value that is compatible with the data type of the parameter (as determined when the prepared statement was created).

Output

The command tag returned by EXECUTE is that of the prepared statement's command tag, not EXECUTE.

Examples

Examples are provided in the Examples section of the PREPARE documentation.

See Also

DEALLOCATE,PREPARE