gcloud oracle-database database-connections execute-sql

INFORMATION
gcloud oracle-database database-connections execute-sql is not available in universe domain universe.
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 SELECT queries as well as DML and DDL statements, which are autocommitted.
EXAMPLES
To execute a SQL statement on a DatabaseConnection with id my-connection in the location us-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 value takes JSON) on a DatabaseConnection with id my-connection in the location us-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 project attribute:

  • provide the argument database_connection on the command line with a fully specified name;
  • provide the argument --project on 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_connection attribute:

  • provide the argument database_connection on the command line.

This positional argument must be specified if any of the other arguments in this group are specified.

--location=LOCATION
The location id of the databaseConnection resource.

To set the location attribute:

  • provide the argument database_connection on the command line with a fully specified name;
  • provide the argument --location on the command line.
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 help for details.

API REFERENCE
This command uses the oracledatabase/v1 API. The full documentation for this API can be found at: https://cloud.google.com/oracle/database/docs