Amazon RDS Data Service
API Reference (API Version 2018-08-01)

ExecuteSql

Runs one or more SQL statements.

Important

This operation is deprecated. Use the BatchExecuteStatement or ExecuteStatement operation.

Request Syntax

POST /ExecuteSql HTTP/1.1 Content-type: application/json { "awsSecretStoreArn": "string", "database": "string", "dbClusterOrInstanceArn": "string", "schema": "string", "sqlStatements": "string" }

URI Request Parameters

The request does not use any URI parameters.

Request Body

The request accepts the following data in JSON format.

awsSecretStoreArn

The Amazon Resource Name (ARN) of the secret that enables access to the DB cluster.

Type: String

Length Constraints: Minimum length of 11. Maximum length of 100.

Required: Yes

database

The name of the database.

Type: String

Length Constraints: Minimum length of 0. Maximum length of 64.

Required: No

dbClusterOrInstanceArn

The ARN of the Aurora Serverless DB cluster.

Type: String

Length Constraints: Minimum length of 11. Maximum length of 100.

Required: Yes

schema

The name of the database schema.

Type: String

Length Constraints: Minimum length of 0. Maximum length of 64.

Required: No

sqlStatements

One or more SQL statements to run on the DB cluster.

You can separate SQL statements from each other with a semicolon (;). Any valid SQL statement is permitted, including data definition, data manipulation, and commit statements.

Type: String

Length Constraints: Minimum length of 0. Maximum length of 65536.

Required: Yes

Response Syntax

HTTP/1.1 200 Content-type: application/json { "sqlStatementResults": [ { "numberOfRecordsUpdated": number, "resultFrame": { "records": [ { "values": [ { "arrayValues": [ "Value" ], "bigIntValue": number, "bitValue": boolean, "blobValue": blob, "doubleValue": number, "intValue": number, "isNull": boolean, "realValue": number, "stringValue": "string", "structValue": { "attributes": [ "Value" ] } } ] } ], "resultSetMetadata": { "columnCount": number, "columnMetadata": [ { "arrayBaseColumnType": number, "isAutoIncrement": boolean, "isCaseSensitive": boolean, "isCurrency": boolean, "isSigned": boolean, "label": "string", "name": "string", "nullable": number, "precision": number, "scale": number, "schemaName": "string", "tableName": "string", "type": number, "typeName": "string" } ] } } } ] }

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

sqlStatementResults

The results of the SQL statement or statements.

Type: Array of SqlStatementResult objects

Errors

BadRequestException

There is an error in the call or in a SQL statement.

HTTP Status Code: 400

ForbiddenException

There are insufficient privileges to make the call.

HTTP Status Code: 403

InternalServerErrorException

An internal error occurred.

HTTP Status Code: 500

ServiceUnavailableError

The service specified by the resourceArn parameter is not available.

HTTP Status Code: 503

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: