Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
is it possible to do SOQL for the unknown object without for loop as below
string theQuery = 'Select '+fiels+' From'+obj_frm +whr;
Map <Id, object> oppMap = new Map<Id, object>((List<object>)Database.query(theQuery));
You need to use SObject as the value, not Object.
Map<Id, SObject> opportunities = new Map<Id, SObject>(Database.query(...));
Required, but never shown