Non-PL/pgSQL statements are sent to the server engine as regular SQL statements. A few examples in the previous sections have already performed some queries within code blocks. It is possible for a code block to construct an SQL statement dynamically to be executed by the server engine. This can be achieved using the EXECUTE statement.
An EXECUTE statement is made of three parts:
- A mandatory query string, which represents the SQL statement that will be executed
- An optional INTO (or INTO STRICT) clause, which allows us to store values from the previous statement in variables
- An optional USING clause, which provides positional values for parameter substitution
The query string will not be interpolated, which means ...