8.20. EXECUTE

Synopsis

  1. EXECUTE statement_name [ USING parameter1 [ , parameter2, ... ] ]

Description

Executes a prepared statement with the name statement_name. Parameter valuesare defined in the USING clause.

Examples

Prepare and execute a query with no parameters:

  1. PREPARE my_select1 FROM
  2. SELECT name FROM nation;
  1. EXECUTE my_select1;

Prepare and execute a query with two parameters:

  1. PREPARE my_select2 FROM
  2. SELECT name FROM nation WHERE regionkey = ? and nationkey < ?;
  1. EXECUTE my_select2 USING 1, 3;

This is equivalent to:

  1. SELECT name FROM nation WHERE regionkey = 1 AND nationkey < 3;

See Also

PREPARE