Select your cookie preferences

We use essential cookies and similar tools that are necessary to provide our site and services. We use performance cookies to collect anonymous statistics, so we can understand how customers use our site and make improvements. Essential cookies cannot be deactivated, but you can choose “Customize” or “Decline” to decline performance cookies.

If you agree, AWS and approved third parties will also use cookies to provide useful site features, remember your preferences, and display relevant content, including relevant advertising. To accept or decline all non-essential cookies, choose “Accept” or “Decline.” To make more detailed choices, choose “Customize.”

EXECUTE

Focus mode
EXECUTE - Amazon Athena

Runs a prepared statement with the name statement_name. Parameter values for the question marks in the prepared statement are defined in the USING clause in a comma separated list. To create a prepared statement, use PREPARE.

Synopsis

EXECUTE statement_name [ USING parameter1[, parameter2, ... ] ]

Examples

The following example prepares and executes a query with no parameters.

PREPARE my_select1 FROM SELECT name FROM nation EXECUTE my_select1

The following example prepares and executes a query with a single parameter.

PREPARE my_select2 FROM SELECT * FROM "my_database"."my_table" WHERE year = ? EXECUTE my_select2 USING 2012

This is equivalent to:

SELECT * FROM "my_database"."my_table" WHERE year = 2012

The following example prepares and executes a query with two parameters.

PREPARE my_select3 FROM SELECT order FROM orders WHERE productid = ? and quantity < ? EXECUTE my_select3 USING 346078, 12

Additional resources

Use prepared statements

PREPARE

INSERT INTO

On this page

PrivacySite termsCookie preferences
© 2025, Amazon Web Services, Inc. or its affiliates. All rights reserved.