The PREPARE statement creates a prepared statement for later execution. The EXECUTE statement runs it with optional arguments. The DEALLOCATE statement removes it.
For details about auto-incremented, positional, and named parameters, see Prepared Statements.
PREPARE
Prepare a statement named query_person:
PREPARE query_person AS
SELECT *
FROM person
WHERE starts_with(name, $name_start)
AND age >= $minimum_age;
Syntax
EXECUTE
Execute a prepared statement with named arguments:
EXECUTE query_person(name_start := 'B', minimum_age := 40);
Execute a prepared statement with positional arguments:
EXECUTE add_values(20, 22);
Syntax
DEALLOCATE
Remove a prepared statement:
DEALLOCATE query_person;
The optional PREPARE keyword is accepted for PostgreSQL compatibility:
DEALLOCATE PREPARE add_values;
Syntax
関連キーワード
関連するページ
© 2026 DuckDB Foundation, Amsterdam NL