+ Start a Discussion
Jayaramu T 9Jayaramu T 9 

String s ='SELECT Account.Name,Contact.Name,Subject,RecordType.Name,Issue_Summary__c FROM Case where Status = 'Closed'';

while saving i a getting following error 
Error: Compile Error: Missing ';' at 'Closed' at line 439 column 120

in above query Status is picklist field values like 'Closed','New',Reopen'
Khan AnasKhan Anas (Salesforce Developers) 
Hi Jayaramu,

Greetings to you!

If you only use the apostrophe ' it will close out of the section you are in. You need to use \' to quote the value you are using. It's called "escaping" the single quotes. 
 
String s = 'SELECT Account.Name,Contact.Name,Subject,RecordType.Name,Issue_Summary__c FROM Case where Status = \'Closed\'';

I hope it helps you.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.

Thanks and Regards,
Khan Anas
Deepali KulshresthaDeepali Kulshrestha
Hi Jayaramu,

Try this ,

String s ='SELECT Account.Name,Contact.Name,Subject,RecordType.Name,Issue_Summary__c FROM Case where Status = 'Closed';

I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.

Thanks and Regards,
Deepali Kulshrestha