Skip to content

pQuery.setNull

Signature: pQuery.setNull(parameterName, targetSqlType)

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 SQL NULL.

Note

You must specify the parameter's SQL type. See the JavaDoc for java.sql.Types.

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
Integer targetSqlType an Integer value from java.sql.Types

Example

// Create the pQuery object
var pQuery = qie.getParameterizedQuery(
  "update patient\n" +
  "set name = :spouseName\n" +
  "where patient_id = :personId"
);

// Identify the row to update
pQuery.setLong("personId", 1001);

// Explicitly set spouse_name to SQL NULL
pQuery.setNull("spouseName", java.sql.Types.VARCHAR);

// Execute the update
pQuery.doQuery("EMR Database");