Help Center/
GaussDB/
M-Compatibility Developer Guide(Centralized)/
SQL Reference/
SQL Syntax/
SQL Statements/
D/
DEALLOCATE
Updated on 2025-10-23 GMT+08:00
DEALLOCATE
Description
Deallocates a previously prepared statement.
Precautions
If you do not explicitly deallocate a prepared statement, it is deallocated when the session ends.
Syntax
{DEALLOCATE | DROP} PREPARE name;
Parameters
name
Specifies the name of the prepared statement to be deallocated.
Examples
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
-- Create three prepared statements q1, q2, and q3, delete q1, and then delete all prepared statements. m_db=# SELECT name, statement, parameter_types FROM pg_prepared_statements; name | statement | parameter_types ------+-----------+----------------- (0 rows) m_db=# PREPARE q1 from 'SELECT 1 AS a'; PREPARE m_db=# PREPARE q2 from 'SELECT 1 AS a'; PREPARE m_db=# PREPARE q3 from 'SELECT 1 AS a'; PREPARE m_db=# SELECT name, statement, parameter_types FROM pg_prepared_statements; name | statement | parameter_types ------+------------------------------+----------------- q1 | PREPARE q1 AS SELECT 1 AS a; | {} q3 | PREPARE q3 AS SELECT 1 AS a; | {} q2 | PREPARE q2 AS SELECT 1 AS a; | {} (3 rows) m_db=# DEALLOCATE PREPARE q1; DEALLOCATE m_db=# SELECT name, statement, parameter_types FROM pg_prepared_statements; name | statement | parameter_types ------+------------------------------+----------------- q3 | PREPARE q3 AS SELECT 1 AS a; | {} q2 | PREPARE q2 AS SELECT 1 AS a; | {} (2 rows) |
Parent topic: D
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
The system is busy. Please try again later.
For any further questions, feel free to contact us through the chatbot.
Chatbot