Apex bound variables reported as errors inside GEOLOCATION SOQL function

Issue #1560 resolved
Aidan Harding created an issue

The following is legitimate Apex, but reported as an error by the code inspector:

Decimal longitude = 0;
Decimal latitude = 0;

Account a = [SELECT Id FROM Account WHERE DISTANCE(ShippingAddress, GEOLOCATION(:latitude, :longitude), 'mi') < 10];

The inspector has a problem with the using the Apex variables in the GEOLOCATION function. It says

'-', FLOATING_POINT_LITERAL or INTEGER_LITERAL expected, got ':'

Comments (2)

  1. Log in to comment