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

System.QueryException: expecting a right parentheses, found 'OFFSET'

i am running soql query dynamically using search.query() and i am facing error 

System.QueryException: expecting a right parentheses, found 'OFFSET'



my query is 


FIND 'USA' IN ALL FIELDS RETURNING Account (SicDesc,ParentId,TickerSymbol,LastModifiedDate,NumberOfEmployees,NumberofLocations__c,ShippingCity,ShippingLatitude,BillingLongitude,Jigsaw,BillingCountry,ShippingCountry,Site,AccountNumber,BillingStreet,Active__c,LastViewedDate,BillingCity,ShippingLongitude,Rating,CreatedById,IsDeleted,Id,ShippingPostalCode,Industry,UpsellOpportunity__c,AccountSource,Phone,SLAExpirationDate__c,Type,OwnerId,ShippingState,BillingLatitude,AnnualRevenue,BillingState,LastActivityDate,BillingPostalCode,SystemModstamp,SLASerialNumber__c,Description,LastReferencedDate,LastModifiedById,Website,ShippingStreet,Fax,SLA__c,CustomerPriority__c,MasterRecordId,Name,CreatedDate,JigsawCompanyId,Sic,Ownership ORDER BY Name OFFSET= 0 LIMIT 5)

i tried many things but every time i am getting some error can any one please tell what should be the right query for selecting 5 accounts with offset 0 including all fields ??
Well does Offset and Limit work with SOSL ?
I am not sure about them. I guess they are related to SOQL.

can you remove them and try again ?

Hi Ritesh,


I think OFFSET doesn't work with SOSL queries.


You can refer to SOQL & SOSL guides for same.


You can try it by removing OFFSET clause.





LIMIT does works with SOSL, but OFFSET does not..Remove that and try.. Let us know if that fixes it..