SQL syntax for prepared statements - Amazon Athena
Services or capabilities described in AWS documentation might vary by Region. To see the differences applicable to the AWS European Sovereign Cloud Region, see the AWS European Sovereign Cloud User Guide.

SQL syntax for prepared statements

You can use the PREPARE, EXECUTE and DEALLOCATE PREPARE SQL statements to run parameterized queries in the Athena console query editor.

  • To specify parameters where you would normally use literal values, use question marks in the PREPARE statement.

  • To replace the parameters with values when you run the query, use the USING clause in the EXECUTE statement.

  • To remove a prepared statement from the prepared statements in a workgroup, use the DEALLOCATE PREPARE statement.

The following sections provide additional detail about each of these statements.