Package org.springframework.jdbc.core

# Class SqlParameterValue

java.lang.Object
org.springframework.jdbc.core.SqlParameter
org.springframework.jdbc.core.SqlParameterValue

public class SqlParameterValue extends SqlParameter
Object to represent an SQL parameter value, including parameter meta-data such as the SQL type and the scale for numeric values.

Designed for use with `JdbcTemplate`'s operations that take an array of argument values: Each such argument value may be a `SqlParameterValue`, indicating the SQL type (and optionally the scale) instead of letting the template guess a default type. Note that this only applies to the operations with a 'plain' argument array, not to the overloaded variants with an explicit type array.

Since:
  2.0.5
Author:
  Juergen Hoeller
See Also:
  - `Types`
  - `JdbcTemplate.query(String, ResultSetExtractor, Object[])`
  - `JdbcTemplate.query(String, RowCallbackHandler, Object[])`
  - `JdbcTemplate.query(String, RowMapper, Object[])`
  - `JdbcTemplate.update(String, Object[])`

## Constructor Summary

Constructors
Constructor
Description
`SqlParameterValue(int sqlType, int scale, Object value)`
Create a new SqlParameterValue, supplying the SQL type.
`SqlParameterValue(int sqlType, Object value)`
Create a new SqlParameterValue, supplying the SQL type.
`SqlParameterValue(int sqlType, String typeName, Object value)`
Create a new SqlParameterValue, supplying the SQL type.
`SqlParameterValue(SqlParameter declaredParam, Object value)`
Create a new SqlParameterValue based on the given SqlParameter declaration.

## Method Summary

Modifier and Type
Method
Description
`Object`
`getValue()`
Return the value object that this parameter value holds.

### Methods inherited from class org.springframework.jdbc.core.SqlParameter

`getName, getScale, getSqlType, getTypeName, isInputValueProvided, isResultsParameter, sqlTypesToAnonymousParameterList`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### SqlParameterValue

public SqlParameterValue(int sqlType, @Nullable Object value)
Create a new SqlParameterValue, supplying the SQL type.

Parameters:
  `sqlType` - the SQL type of the parameter according to `java.sql.Types`
  `value` - the value object

### SqlParameterValue

public SqlParameterValue(int sqlType, @Nullable String typeName, @Nullable Object value)
Create a new SqlParameterValue, supplying the SQL type.

Parameters:
  `sqlType` - the SQL type of the parameter according to `java.sql.Types`
  `typeName` - the type name of the parameter (optional)
  `value` - the value object

### SqlParameterValue

public SqlParameterValue(int sqlType, int scale, @Nullable Object value)
Create a new SqlParameterValue, supplying the SQL type.

Parameters:
  `sqlType` - the SQL type of the parameter according to `java.sql.Types`
  `scale` - the number of digits after the decimal point (for DECIMAL and NUMERIC types)
  `value` - the value object

### SqlParameterValue

public SqlParameterValue(SqlParameter declaredParam, @Nullable Object value)
Create a new SqlParameterValue based on the given SqlParameter declaration.

Parameters:
  `declaredParam` - the declared SqlParameter to define a value for
  `value` - the value object

## Method Details

### getValue

@Nullable public Object getValue()
Return the value object that this parameter value holds.