function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Ketan MahetKetan Mahet 

Return 0 or empty string from SOQL query result.

Hi,
  Where retrieving data using SOQL, some of the field has value as null. Is there any way to return 0 or '' from the SOQL query result?

Regards,
Ketan Mehta
Best Answer chosen by Ketan Mahet
Himanshu ParasharHimanshu Parashar
Hi Ketan,

Like other language SOQL doen't support isNULL keyword in Select clause but as Anupam already asked it would be great if you can describe your requirement so that we can suggest some solutions.


Thanks,
Himanshu

All Answers

Anupam RastogiAnupam Rastogi
Hi Ketan,

What is your complete requirement?

Thanks
AR
Himanshu ParasharHimanshu Parashar
Hi Ketan,

Like other language SOQL doen't support isNULL keyword in Select clause but as Anupam already asked it would be great if you can describe your requirement so that we can suggest some solutions.


Thanks,
Himanshu
This was selected as the best answer
Varun PareekVarun Pareek
Short answer - No, you can't. However, if you are using apex; you may be able to handle that with some other workaround in the code. But from pure SOQL point of view this isn't possble per my knowledge.
Ketan MahetKetan Mahet

Sorry, the quetion was not asked efficiently...  I was expecting something like isNull technique available in SQL. I don't want to check for null in result from SOQL. I think, for improving performance this can help. 
But Himanshu Parashar, clear it all the way.... 
Thxs...