+ Start a Discussion
etechcareersetechcareers 

instead of Null what do we use????

Hi all:

   Instead of nulls in SOQL query for date values what should we use?

For example:

 

Account acct =[Select name from Account where xdate__c=NULL];

 I heard that nulls for date values are not good in SOQL Queries?

 

sfdcfoxsfdcfox

If you're looking for records where a date is blank, then you should compare against NULL. The example query you posted would return account records that have xdate__c as a blank (or NULL) value. Note that your specific example would fail in the event that more than one record matched the criteria, so you would want to add a LIMIT 1 to the query, make the assignment into an array, or use a for-loop.

 

Edit: changed typo.