New in v0.9.7.
PREPARE creates a prepared statement by parsing the initial
DELETE statement. A subsequent
EXECUTE statement then plans and executes the statement.
|name||A name for this particular prepared statement that you can later use to execute or deallocate a statement. The name must be unique within a session.|
Prepared statements can take parameters: values that are substituted into the statement when it is executed. The data type is inferred from the context in which the parameter is first referenced. To refer to the parameters in the prepared statement itself, use
Prepared statements only last for the duration of the current database session. You can also delete them during a session with the
Create a prepared statement
PREPARE a AS SELECT 1 + $1;
Execute a prepared statement
EXECUTE a ('a', 'b', 1 + 2)
Deallocate a prepared statement