For the past couple of weeks our Continuous Integration (CI) build that uses SFDX and scratch orgs has had most of its queries failing for the Platform Encryption org with this error:

common.exception.SfdcSqlException: ORA-00932: inconsistent datatypes: expected CHAR got DATE

The code appears to work fine once packaged and then deployed.

This had been working fine and our build configuration has not changed in this area. Any ideas on where to look or how to fix this?


There is this known issue Internal Server Error when doing SOQL query of formula field using an encrypted Date/Time field that looks like the same thing, but unclear why our production environments aren't affected too. Any ideas on that?


Now thinking it is code change that has made this start to happen. The queries are wildcarded (via describe calls) and more fields have been added.


Starting to get to the bottom of this now. The lines of code have not changed that do the query, but the query includes all fields of an object and a Date type formula field was recently added that references an encrypted Date field.

So it is an example of Internal Server Error when doing SOQL query of formula field using an encrypted Date/Time field.

Will now look for a workaround for my specific case. There is a small chance that if all the fields in the formula are encrypted it will work.

Looks like a workaround is to ensure that all the date fields in the formula are encrypted rather than some being encrypted and some not. But for my case this Any way out of "Encryption can't be enabled for fields referenced in the custom formula fields"? gets in the way. Aaaaaaaargh.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.