Skip to content

pQuery.setBigDecimal

Signature: pQuery.setBigDecimal(parameterName, value)

Returns: ParameterizedQuery pQuery - this ParameterizedQuery object. To see what methods can be used on a ParameterizedQuery, refer to the 'Parameterized Query' functions.

Sets the parameterName to the given java.math.BigDecimal value.

Note

The JDBC driver converts this to an SQL NUMERIC value when it sends it to the database.

Note

The parameterName may include the parameter prefix character (colon ':' or at sign '@') but is not required. For example: ':fieldValue' and 'fieldValue' will reference the same named parameter.

Parameters

Type Name Description Default
String parameterName the name of the parameter
String or BigDecimal value the value to use for parameterName

Example

// Create the pQuery object with the SQL to be called
var pQuery = qie.getParameterizedQuery(
   `select name from patient
    WHERE patient_id = :patientId
    AND balance = :favoriteNumber`
);

// Example: value as String
pQuery.setBigDecimal("patientId", "7");
pQuery.setBigDecimal("favoriteNumber", "42.50");

// Execute the query
var queryResult = pQuery.doQuery("EMR Database");


// Example: value as BigDecimal
pQuery = qie.getParameterizedQuery(
   `select name from patient
    WHERE patient_id = :patientId
    AND balance = :favoriteNumber`
);

pQuery.setBigDecimal("patientId", 7);
pQuery.setBigDecimal("favoriteNumber", 42.50);

queryResult = pQuery.doQuery("EMR Database");

// Example: parameterName with prefix and value as String
pQuery = qie.getParameterizedQuery(
   `select name from patient
    WHERE patient_id = :patientId
    AND balance = :favoriteNumber`
);

pQuery.setBigDecimal(":patientId", "7");
pQuery.setBigDecimal(":favoriteNumber", "42.50");

queryResult = pQuery.doQuery("EMR Database");