You need to sign in to do that
Don't have an account?
URVASHI
database.query(Srting query)
hi,
can some help me
List<SObject> ObjectContents;
String query=Select name from contact;
ObjectContents = database.query(query);
if my query returns 2 rows then size of objectcontents wll be how much?
Thanks.
Hello URVASHI,
If your query returns 2 rows then the size of ObjectContents will be 2.
You can check it by writing debug statement like System.debug('=====ObjectContents size====='+ObjectContents.size());
Best Practice : Try to put the Limit clause in queries though you have less number of records than Salesforce governor limits.
Let me know if you need any more information.
Thanks,
Amit Shingavi
All Answers
Run the code in console.
Hello URVASHI,
If your query returns 2 rows then the size of ObjectContents will be 2.
You can check it by writing debug statement like System.debug('=====ObjectContents size====='+ObjectContents.size());
Best Practice : Try to put the Limit clause in queries though you have less number of records than Salesforce governor limits.
Let me know if you need any more information.
Thanks,
Amit Shingavi
Hey can u tell me whats the limit clause?
Use LIMIT to specify the maximum number of rows to return:
SELECT fieldList
FROM objectType
[WHERE conditionExpression]
LIMIT number_of_rows
Example:
SELECT Name
FROM Account
WHERE Industry = 'Media' LIMIT 100
This query returns the first 100 Account records whose Industry is Media.