---
title: "POST /v1/projects/{projectsId}/locations/{locationsId}/databaseConnections/{databaseConnectionsId}:executeSql"
method: POST
path: "/v1/projects/{projectsId}/locations/{locationsId}/databaseConnections/{databaseConnectionsId}:executeSql"
tags: ["projects"]
---

# POST /v1/projects/{projectsId}/locations/{locationsId}/databaseConnections/{databaseConnectionsId}:executeSql

`POST /v1/projects/{projectsId}/locations/{locationsId}/databaseConnections/{databaseConnectionsId}:executeSql`

## Request

- Base URL: `https://oracledatabase.googleapis.com`
- URL: `https://oracledatabase.googleapis.com/v1/projects/{projectsId}/locations/{locationsId}/databaseConnections/{databaseConnectionsId}:executeSql`
- Auth: OAuth 2 and OAuth 2
  - Implicit: `https://accounts.google.com/o/oauth2/auth`
  - Scopes: `https://www.googleapis.com/auth/cloud-platform`
  - Authorization code: `https://accounts.google.com/o/oauth2/auth`
  - Token URL: `https://accounts.google.com/o/oauth2/token` scopes: `https://www.googleapis.com/auth/cloud-platform`

Executes a SQL statement on a DatabaseConnection.

## Path parameters

- `projectsId` string, required
- `locationsId` string, required
- `databaseConnectionsId` string, required

## Query parameters

- `$.xgafv` '1' | '2'
- `access_token` string
- `alt` 'json' | 'media' | 'proto'
- `callback` string
- `fields` string
- `key` string
- `oauth_token` string
- `prettyPrint` boolean
- `quotaUser` string
- `uploadType` string
- `upload_protocol` string

## Request body

- ExecuteSqlRequest: The request for `DatabaseConnection.ExecuteSql`.
  - `params` SqlParameter[]: Optional. Optional: Bind variables (parameters) to be used with the SQL statement. Supports named bind variables (e.g., :dept_id, :status in Oracle SQL) or positional parameters (:1, :2).
    - `name` string: Optional. The name of the SQL bind parameter (excluding the leading colon, e.g. "id"). If omitted, parameters bind positionally based on their order in the list.
    - `typeName` string: Optional. Optional: Datatype hint for the parameter (e.g., "VARCHAR2", "NUMBER", "DATE", "TIMESTAMP"). If omitted, the Oracle driver will infer the type from the value string.
    - `value` unknown
  - `sqlStatement` string: Required. The SQL statement to execute.

## Response `200`

Successful response

- ExecuteSqlResponse: Execute a SQL statement response.
  - `metadata` ExecuteSqlMetadata: Any additional metadata information regarding the execution of the SQL
    - `executionDuration` string, google-duration: The time duration taken to execute the sql statement.
    - `message` string: Message related to SQL execution. This field can be used to convey size limit related message.
    - `partialResult` boolean: Set to true if SQL returned a result set larger than the acceptable response size limits and the result was truncated.
    - `status` 'STATUS_UNSPECIFIED' | 'OK' | 'PARTIAL' | 'ERROR': Output only. Status of SQL execution.
  - `sqlResults` SqlResult[]: SqlResult represents the results for the execution of sql statements.
    - `columns` Column[]: List of columns included in the result, including data type.
      - `name` string: Required. Name of the column.
      - `type` string: Required. Database-specific type name (e.g., "VARCHAR2(255)", "NUMBER", "DATE", "CLOB")
    - `rows` Row[]: Rows returned by the SQL statement.
      - `values` Value[]: List of values in a row of sql result.
        - `nullValue` boolean: Set to true if the cell value is NULL.
        - `value` string: The cell value represented in string format. Timestamps should be converted using RFC3339Nano format.

---

[API](https://skmtc.dev/google/apis/oracledatabase.md) - [All operations](https://skmtc.dev/google/apis/oracledatabase/llms.txt) - [OpenAPI document](https://skmtc.dev/google/apis/oracledatabase/revisions/215e9c1e9c3f?raw)
