SET OPTIONS

Use the SET OPTIONS clause to configure query behavior.

Syntax 

1[SET OPTIONS (optionName = optionValue [, optionName = optionValue])]

Example 

1SELECT Id, Name
2FROM MyDLO__dlm
3WHERE Status__c = 'Active'
4SET OPTIONS (dataspace = 'default', honorEmptyStrings = true)

dataspace Option 

Use dataspace to specify which dataspace to query when querying a DLO. If the dataspace isn’t specified, the query returns zero records. Valid only for DLO queries, not supported for data model object (DMO) queries.

OptionValues
dataspace'<dataspaceName>' (string)

Example

1SELECT AccountId__c, Email__c
2FROM CustomerProfile__dlm
3SET OPTIONS (dataspace = 'default')

honorEmptyStrings Option 

Salesforce Platform objects don’t distinguish between NULL and an empty string (''). A SOQL query filtering on either value returns the same records. Data 360 DLOs treat NULL and empty string as different values. Use honorEmptyStrings to control how filtering behaves when querying DLOs.

The honorEmptyStrings option also supports simple queries for DMOs.

OptionValuesBehavior
honorEmptyStringstrueNULL and empty string are treated as different values. Filtering returns different record sets depending on whether the value is NULL or ''.
honorEmptyStringsfalse (default)NULL and empty string are treated as the same value. Consistent with querying Salesforce Platform objects.

Examples

This query returns records where EmailOptIn__c is either NULL or ''.

1SELECT Id, EmailOptIn__c
2FROM ContactDLO__dlm
3WHERE EmailOptIn__c = ''
4SET OPTIONS (dataspace = 'default', honorEmptyStrings = false)

This query returns only records where EmailOptIn__c is an empty string.

1SELECT Id, EmailOptIn__c
2FROM ContactDLO__dlm
3WHERE EmailOptIn__c = ''
4SET OPTIONS (dataspace = 'default', honorEmptyStrings = true)

explicitNamespace Option 

Use explicitNamespace to enable explicit namespace resolution for a dynamic SOQL query. This option is applicable to only managed Apex, and you must pass the option as a bind variable. See Prevent Field Name Collisions in Managed SOQL Queries in the Apex Developer Guide.