8
Count Query | Method in Apex Database Class
Chapter Topics
- What Is DML In Salesforce?
- Insert | APEX DML Standalone Statements
- Update | APEX DML Standalone Statements
- Upsert | APEX DML Standalone Statements
- Delete | Apex DML Standalone Statement
- Undelete | Apex DML Standalone Statement
- Merge | APEX DML Standalone Statements
- APEX DML Statements Best Practices
- Database Class in APEX
- Empty Recycle Bin
- Count Query | Method in Apex Database Class
- Lead Conversion | Method in Apex Database Class
- Transaction Control and Rollback
- Database Class Method Result Object
countQuery(String str)
Returns the number of records that a dynamic SOQL query would return when executed.
Example countQuery Method In Database Class
Integer i = Database.countQuery(‘SELECT Count() FROM Account’);
System.debug(i);
Note:
countQuery will not work if we enter any field inside the count.
count() // ok
count(ID) // error
Next Topic
Need more support?
Get a head start with our FREE study notes!
Learn more and get all the answers you need at zero cost. Improve your skills using our detailed notes prepared by industry experts to help you excel.