- INFORMATION
-
gcloud oracle-database database-connections execute-sqlis not available in universe domainuniverse. - NAME
-
- gcloud oracle-database database-connections execute-sql - execute a SQL statement on a DatabaseConnection
- SYNOPSIS
-
-
gcloud oracle-database database-connections execute-sql(DATABASE_CONNECTION:--location=LOCATION)--sql-statement=SQL_STATEMENT[--params=[name=NAME],[typeName=TYPENAME],[value=VALUE]] [GCLOUD_WIDE_FLAG …]
-
- DESCRIPTION
-
Executes a SQL statement on a DatabaseConnection. Supports
SELECTqueries as well as DML and DDL statements, which are autocommitted. - EXAMPLES
-
To execute a SQL statement on a DatabaseConnection with id
my-connectionin the locationus-east4, run:gcloud oracle-database database-connections execute-sql my-connection --location=us-east4 --sql-statement="SELECT 1 FROM DUAL"To execute a parameterized SQL statement with bind variables (where
valuetakes JSON) on a DatabaseConnection with idmy-connectionin the locationus-east4, run:gcloud oracle-database database-connections execute-sql my-connection --location=us-east4 --sql-statement="SELECT * FROM employees WHERE department_id = :dept_id AND status = :status" --params='name=dept_id,value=10' --params='name=status,value="ACTIVE"' - POSITIONAL ARGUMENTS
-
-
DatabaseConnection resource - The name of the DatabaseConnection in the
following format:
projects/{project}/locations/{location}/databaseConnections/{database_connection}.
The arguments in this group can be used to specify the attributes of this
resource. (NOTE) Some attributes are not given arguments in this group but can
be set in other ways.
To set the
projectattribute:-
provide the argument
database_connectionon the command line with a fully specified name; -
provide the argument
--projecton the command line; -
set the property
core/project.
This must be specified.
DATABASE_CONNECTION-
ID of the databaseConnection or fully qualified identifier for the
databaseConnection.
To set the
database_connectionattribute:-
provide the argument
database_connectionon the command line.
This positional argument must be specified if any of the other arguments in this group are specified.
-
provide the argument
--location=LOCATION-
The location id of the databaseConnection resource.
To set the
locationattribute:-
provide the argument
database_connectionon the command line with a fully specified name; -
provide the argument
--locationon the command line.
-
provide the argument
-
provide the argument
-
DatabaseConnection resource - The name of the DatabaseConnection in the
following format:
projects/{project}/locations/{location}/databaseConnections/{database_connection}.
The arguments in this group can be used to specify the attributes of this
resource. (NOTE) Some attributes are not given arguments in this group but can
be set in other ways.
- REQUIRED FLAGS
-
--sql-statement=SQL_STATEMENT- The SQL statement to execute.
- OPTIONAL FLAGS
-
--params=[name=NAME],[typeName=TYPENAME],[value=VALUE]-
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- 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- 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- Use protobuf.Value so clients can pass ints, bools, and strings natively.
Shorthand Example:--params=name=string,typeName=string,value={…} --params=name=string,typeName=string,value={…}
JSON Example:--params='[{"name": "string", "typeName": "string", "value": {…}}]'
File Example:--params=path_to_file.(yaml|json)
- GCLOUD WIDE FLAGS
-
These flags are available to all commands:
--access-token-file,--account,--billing-project,--configuration,--flags-file,--flatten,--format,--help,--impersonate-service-account,--log-http,--project,--quiet,--trace-token,--user-output-enabled,--verbosity.Run
$ gcloud helpfor details. - API REFERENCE
-
This command uses the
oracledatabase/v1API. The full documentation for this API can be found at: https://cloud.google.com/oracle/database/docs
gcloud oracle-database database-connections execute-sql
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2026-10-27 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2026-10-27 UTC."],[],[]]