# Class QueryParameterValue (2.65.0)

2.65.0 (latest) 2.62.0 2.61.0 2.60.0 2.59.0 2.58.0 2.57.2 2.56.0 2.55.3 2.54.2 2.53.0 2.52.0 2.51.0 2.50.1 2.49.0 2.48.1 2.47.0 2.46.0 2.45.0 2.44.0 2.43.3 2.42.3 2.41.0 2.40.3 2.39.1 2.38.2 2.37.2 2.36.0 2.35.0 2.34.2 2.33.2

    public abstract class QueryParameterValue implements Serializable

A value for a QueryParameter along with its type.

A static factory method is provided for each of the possible types (e.g. [#int64(Long)](https://docs.cloud.google.com/java/docs/reference/google-cloud-bigquery/latest/com.google.cloud.bigquery.QueryParameterValue#com_google_cloud_bigquery_QueryParameterValue_int64_java_lang_Long_)
for StandardSQLTypeName.INT64). Alternatively, an instance can be constructed by calling [#of(Object, Class)](https://docs.cloud.google.com/java/docs/reference/google-cloud-bigquery/latest/com.google.cloud.bigquery.QueryParameterValue#com_google_cloud_bigquery_QueryParameterValue_of_) with the value and a Class object, which will use these mappings:

- Boolean: StandardSQLTypeName.BOOL
- String: StandardSQLTypeName.STRING
- Integer: StandardSQLTypeName.INT64
- Long: StandardSQLTypeName.INT64
- Double: StandardSQLTypeName.FLOAT64
- Float: StandardSQLTypeName.FLOAT64
- BigDecimal: StandardSQLTypeName.NUMERIC
- BigNumeric: StandardSQLTypeName.BIGNUMERIC
- JSON: StandardSQLTypeName.JSON
- INTERVAL: StandardSQLTypeName.INTERVAL

No other types are supported through that entry point. The other types can be created by
calling [#of(Object, StandardSQLTypeName)](https://docs.cloud.google.com/java/docs/reference/google-cloud-bigquery/latest/com.google.cloud.bigquery.QueryParameterValue#com_google_cloud_bigquery_QueryParameterValue_of_) with the value and a particular
StandardSQLTypeName enum value.

Struct parameters are currently not supported.

## Inheritance

[java.lang.Object](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html) \> QueryParameterValue

## Implements

[Serializable](https://docs.oracle.com/javase/8/docs/api/java/io/Serializable.html)

## Inherited Members

[Object.clone()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone--) [Object.equals(Object)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-) [Object.finalize()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#finalize--) [Object.getClass()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--) [Object.hashCode()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--) [Object.notify()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify--) [Object.notifyAll()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll--) [Object.toString()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--) [Object.wait()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--) [Object.wait(long)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-) [Object.wait(long,int)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-)

## Static Methods

### \<T\>array(T\[\] array, StandardSQLTypeName type)

    public static QueryParameterValue <T>array(T[] array, StandardSQLTypeName type)

Creates a `QueryParameterValue` object with a type of ARRAY the given array element type.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `array` | `T[]` |
| `type` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-bigquery/latest/com.google.cloud.bigquery.StandardSQLTypeName` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-bigquery/latest/com.google.cloud.bigquery.QueryParameterValue` |   |

### \<T\>array(T\[\] array, Class\<T\> clazz)

    public static QueryParameterValue <T>array(T[] array, Class<T> clazz)

Creates a `QueryParameterValue` object with a type of ARRAY, and an array element type
based on the given class.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `array` | `T[]` |
| `clazz` | `https://docs.oracle.com/javase/8/docs/api/java/lang/Class.html<T>` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-bigquery/latest/com.google.cloud.bigquery.QueryParameterValue` |   |

### \<T\>of(T value, StandardSQLTypeName type)

    public static QueryParameterValue <T>of(T value, StandardSQLTypeName type)

Creates a `QueryParameterValue` object with the given value and type.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `value` | `T` |
| `type` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-bigquery/latest/com.google.cloud.bigquery.StandardSQLTypeName` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-bigquery/latest/com.google.cloud.bigquery.QueryParameterValue` |   |

### \<T\>of(T value, Class\<T\> type)

    public static QueryParameterValue <T>of(T value, Class<T> type)

Creates a `QueryParameterValue` object with the given value and type. Note: this does not
support BigNumeric

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `value` | `T` |
| `type` | `https://docs.oracle.com/javase/8/docs/api/java/lang/Class.html<T>` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-bigquery/latest/com.google.cloud.bigquery.QueryParameterValue` |   |

### bigNumeric(BigDecimal value)

    public static QueryParameterValue bigNumeric(BigDecimal value)

Creates a `QueryParameterValue` object with a type of BIGNUMERIC.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `value` | `https://docs.oracle.com/javase/8/docs/api/java/math/BigDecimal.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-bigquery/latest/com.google.cloud.bigquery.QueryParameterValue` |   |

### bool(Boolean value)

    public static QueryParameterValue bool(Boolean value)

Creates a `QueryParameterValue` object with a type of BOOL.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `value` | `https://docs.oracle.com/javase/8/docs/api/java/lang/Boolean.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-bigquery/latest/com.google.cloud.bigquery.QueryParameterValue` |   |

### bytes(byte\[\] value)

    public static QueryParameterValue bytes(byte[] value)

Creates a `QueryParameterValue` object with a type of BYTES.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `value` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html[]` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-bigquery/latest/com.google.cloud.bigquery.QueryParameterValue` |   |

### date(String value)

    public static QueryParameterValue date(String value)

Creates a `QueryParameterValue` object with a type of DATE. Must be in the format
"yyyy-MM-dd", e.g. "2014-08-19".

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `value` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-bigquery/latest/com.google.cloud.bigquery.QueryParameterValue` |   |

### dateTime(String value)

    public static QueryParameterValue dateTime(String value)

Creates a `QueryParameterValue` object with a type of DATETIME. Must be in the format
"yyyy-MM-dd HH:mm:ss.SSSSSS", e.g. "2014-08-19 12:41:35.220000".

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `value` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-bigquery/latest/com.google.cloud.bigquery.QueryParameterValue` |   |

### float64(Double value)

    public static QueryParameterValue float64(Double value)

Creates a `QueryParameterValue` object with a type of FLOAT64.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `value` | `https://docs.oracle.com/javase/8/docs/api/java/lang/Double.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-bigquery/latest/com.google.cloud.bigquery.QueryParameterValue` |   |

### float64(Float value)

    public static QueryParameterValue float64(Float value)

Creates a `QueryParameterValue` object with a type of FLOAT64.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `value` | `https://docs.oracle.com/javase/8/docs/api/java/lang/Float.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-bigquery/latest/com.google.cloud.bigquery.QueryParameterValue` |   |

### geography(String value)

    public static QueryParameterValue geography(String value)

Creates a `QueryParameterValue` object with a type of GEOGRAPHY.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `value` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-bigquery/latest/com.google.cloud.bigquery.QueryParameterValue` |   |

### int64(Integer value)

    public static QueryParameterValue int64(Integer value)

Creates a `QueryParameterValue` object with a type of INT64.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `value` | `https://docs.oracle.com/javase/8/docs/api/java/lang/Integer.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-bigquery/latest/com.google.cloud.bigquery.QueryParameterValue` |   |

### int64(Long value)

    public static QueryParameterValue int64(Long value)

Creates a `QueryParameterValue` object with a type of INT64.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `value` | `https://docs.oracle.com/javase/8/docs/api/java/lang/Long.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-bigquery/latest/com.google.cloud.bigquery.QueryParameterValue` |   |

### interval(String value)

    public static QueryParameterValue interval(String value)

Creates a `QueryParameterValue` object with a type of INTERVAL. Must be in the canonical
format "\[sign\]Y-M \[sign\]D \[sign\]H:M:S\[.F\]", e.g. "123-7 -19 0:24:12.000006" or ISO 8601
duration format, e.g. "P123Y7M-19DT0H24M12.000006S"

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `value` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-bigquery/latest/com.google.cloud.bigquery.QueryParameterValue` |   |

### interval(PeriodDuration value)

    public static QueryParameterValue interval(PeriodDuration value)

> [!WARNING]
> **Obsolete**
>
> *Use interval(String) instead*
>
> This feature is stable for usage in this major version, but may be deprecated in a future release.

Creates a `QueryParameterValue` object with a type of INTERVAL. This method is obsolete.
Use [#interval(String)](https://docs.cloud.google.com/java/docs/reference/google-cloud-bigquery/latest/com.google.cloud.bigquery.QueryParameterValue#com_google_cloud_bigquery_QueryParameterValue_interval_java_lang_String_) instead.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `value` | `org.threeten.extra.PeriodDuration` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-bigquery/latest/com.google.cloud.bigquery.QueryParameterValue` |   |

### json(JsonObject value)

    public static QueryParameterValue json(JsonObject value)

Creates a `QueryParameterValue` object with a type of JSON. Currently, this is only
supported in INSERT, not in query as a filter

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `value` | `com.google.gson.JsonObject` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-bigquery/latest/com.google.cloud.bigquery.QueryParameterValue` |   |

### json(String value)

    public static QueryParameterValue json(String value)

Creates a `QueryParameterValue` object with a type of JSON. Currently, this is only
supported in INSERT, not in query as a filter

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `value` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-bigquery/latest/com.google.cloud.bigquery.QueryParameterValue` |   |

### newBuilder()

    public static QueryParameterValue.Builder newBuilder()

Returns a builder for the `QueryParameterValue` object.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-bigquery/latest/com.google.cloud.bigquery.QueryParameterValue.Builder` |   |

### numeric(BigDecimal value)

    public static QueryParameterValue numeric(BigDecimal value)

Creates a `QueryParameterValue` object with a type of NUMERIC.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `value` | `https://docs.oracle.com/javase/8/docs/api/java/math/BigDecimal.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-bigquery/latest/com.google.cloud.bigquery.QueryParameterValue` |   |

### range(Range value)

    public static QueryParameterValue range(Range value)

Creates a `QueryParameterValue` object with a type of RANGE.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `value` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-bigquery/latest/com.google.cloud.bigquery.Range` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-bigquery/latest/com.google.cloud.bigquery.QueryParameterValue` |   |

### string(String value)

    public static QueryParameterValue string(String value)

Creates a `QueryParameterValue` object with a type of STRING.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `value` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-bigquery/latest/com.google.cloud.bigquery.QueryParameterValue` |   |

### struct(Map\<String,QueryParameterValue\> struct)

    public static QueryParameterValue struct(Map<String,QueryParameterValue> struct)

Creates a map with `QueryParameterValue` object and a type of STRUCT the given struct
element type.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `struct` | `https://docs.oracle.com/javase/8/docs/api/java/util/Map.html<https://docs.oracle.com/javase/8/docs/api/java/lang/String.html,https://docs.cloud.google.com/java/docs/reference/google-cloud-bigquery/latest/com.google.cloud.bigquery.QueryParameterValue>` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-bigquery/latest/com.google.cloud.bigquery.QueryParameterValue` |   |

### time(String value)

    public static QueryParameterValue time(String value)

Creates a `QueryParameterValue` object with a type of TIME. Must be in the format
"HH:mm:ss.SSSSSS", e.g. "12:41:35.220000".

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `value` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-bigquery/latest/com.google.cloud.bigquery.QueryParameterValue` |   |

### timestamp(Long value)

    public static QueryParameterValue timestamp(Long value)

Creates a `QueryParameterValue` object with a type of TIMESTAMP.

This method only supports microsecond precision for timestamp. To use higher precision,
prefer [#timestamp(String)](https://docs.cloud.google.com/java/docs/reference/google-cloud-bigquery/latest/com.google.cloud.bigquery.QueryParameterValue#com_google_cloud_bigquery_QueryParameterValue_timestamp_java_lang_String_) with an ISO8601 String

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `value` | `https://docs.oracle.com/javase/8/docs/api/java/lang/Long.html` Microseconds since epoch, e.g. 1733945416000000 corresponds to 2024-12-11 19:30:16.929Z |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-bigquery/latest/com.google.cloud.bigquery.QueryParameterValue` |   |

### timestamp(String value)

    public static QueryParameterValue timestamp(String value)

Creates a `QueryParameterValue` object with a type of TIMESTAMP.

This method supports up to picosecond precision (12 digits) for timestamp. Input should
conform to ISO8601 format.

Should be in the format "yyyy-MM-dd HH:mm:ss.SSSSSS{SSSSSSS}Z", e.g. "2014-08-19
12:41:35.123456Z" for microsecond precision and "2014-08-19 12:41:35.123456789123Z" for
picosecond precision

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `value` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-bigquery/latest/com.google.cloud.bigquery.QueryParameterValue` |   |

## Methods

### getArrayType()

    public abstract StandardSQLTypeName getArrayType()

Returns the data type of the array elements.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-bigquery/latest/com.google.cloud.bigquery.StandardSQLTypeName` |   |

### getArrayValues()

    public List<QueryParameterValue> getArrayValues()

Returns the array values of this parameter. The returned list, if not null, is immutable.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/util/List.html<https://docs.cloud.google.com/java/docs/reference/google-cloud-bigquery/latest/com.google.cloud.bigquery.QueryParameterValue>` |   |

### getRangeValues()

    public Range getRangeValues()

Returns the struct values of this parameter. The returned map, if not null, is immutable.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-bigquery/latest/com.google.cloud.bigquery.Range` |   |

### getStructTypes()

    public Map<String,QueryParameterValue> getStructTypes()

Returns the data type of the struct elements.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/util/Map.html<https://docs.oracle.com/javase/8/docs/api/java/lang/String.html,https://docs.cloud.google.com/java/docs/reference/google-cloud-bigquery/latest/com.google.cloud.bigquery.QueryParameterValue>` |   |

### getStructValues()

    public Map<String,QueryParameterValue> getStructValues()

Returns the struct values of this parameter. The returned map, if not null, is immutable.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/util/Map.html<https://docs.oracle.com/javase/8/docs/api/java/lang/String.html,https://docs.cloud.google.com/java/docs/reference/google-cloud-bigquery/latest/com.google.cloud.bigquery.QueryParameterValue>` |   |

### getType()

    public abstract StandardSQLTypeName getType()

Returns the data type of this parameter.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-bigquery/latest/com.google.cloud.bigquery.StandardSQLTypeName` |   |

### getValue()

    public abstract String getValue()

Returns the value of this parameter.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |   |

### toBuilder()

    public abstract QueryParameterValue.Builder toBuilder()

Returns a builder for a QueryParameterValue object with given value.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-bigquery/latest/com.google.cloud.bigquery.QueryParameterValue.Builder` |   |