This article introduces two methods for executing SQL statements in batch: using the gexec convenient command in psql and using dynamic SQL.