+ Start a Discussion
Chris Gunn 9Chris Gunn 9 

SOQL Query Editor Not returning any results Line: 1, Column: 0 required (...)+ loop did not match anything at input 'SELECT'

I have many accounts in my org and when I execute (in Query Editor) "SELECT Name FROM Account" I am receiving "Line: 1, Column: 0
required (...)+ loop did not match anything at input 'SELECT'" 

I am not sure why. If I test this through Apex code, i still don't receive any results. For example:

Account[] accs = [SELECT Name  FROM Account];
System.debug('@@accounts: ' + accs);

I've also tried
List<Account> accs = [SELECT Name  FROM Account];

returns an empty array.

Any suggestions? This is bugging me incredibly. I've tried Contacts too and still does not return any results.
Karthi XaviKarthi Xavi
Hello Chris,
 Your Query seems correct, there should not be any issue with this SOQL query, If you have any records it should list out all the records when you execute this in Developer Console,  Could you tel us which Query editor you are using and could you place your apex here?.
Chris Gunn 9Chris Gunn 9
Hi Karthikeyan,

Thanks for your response. Two things I have figured out - 1.) The SOQL query worked when I used Query editor from the tab at the bottom of Dev console (next to Checkpoints, Tests, etc). However, I get that error when using Query editor from CTRL + E (from debug menu). Why does it work for one Query editor but not the other? Or is CTRL + E not a Query editor?

2.) The reason why that simple SOQL query wasn't retrieving any results in code either, was because I was using a test class to execute my code. I did not know that you need to declare @Test(seeAllData=true) to see your data when running a test. It was not mentioned anywhere in this trail and was driving me crazy as to why my SOQL wasn't returning any results. They should mention that in this trail: https://trailhead.salesforce.com/force_com_dev_intermediate/asynchronous_apex/async_apex_future_methods
Veena GopalVeena Gopal
Thank you soooo much for the reply. i was also facing the same issue today and i got the answer here. thanks once again
Veena GopalVeena Gopal
thank you Chris Gunn 9