You need to sign in to do that
Don't have an account?
daffentranger
Dynamic QueryMore in Apex?
Does APEX allow the ability to use the Query More operation in a dynamic way?
I am able to use the querymore functionality via a for loop with a select statement however if I try and replace my select statement with a dynamic database.query I can't get it to work. For example I need something like below to work. Any ideas?
String s = 'SELECT ID FROM PRODUCT2'; for (Product2 p: Database.query(s)) { // do something }
Strange, mine returns every record.
This was my sample code, I ran in execute anonymous:
String s = 'SELECT ID FROM PRODUCT2'; Integer i=0; for (Product2 p: Database.query(s)) { system.debug('\n\n'+p); i++; } system.debug('\n\nGOT '+i+' rows');
All Answers
Strange, mine returns every record.
This was my sample code, I ran in execute anonymous:
String s = 'SELECT ID FROM PRODUCT2'; Integer i=0; for (Product2 p: Database.query(s)) { system.debug('\n\n'+p); i++; } system.debug('\n\nGOT '+i+' rows');