Apex不支持SELECT *这种写法,需要用Schema来解决:
(这里以PriceBookEntry为例)
Schema.DescribeSObjectResult dsr = PriceBookEntry.SObjectType.getDescribe(); List<String> allFileds = new List<String>(); allFileds.addAll(dsr.fields.getMap().keySet()); String soql = 'SELECT '+String.join(allFileds, ',')+' FROM PriceBookEntry';