An anonymous block is Apex code that does not get stored in the metadata, but that can be compiled and executed using one of the following:
• Developer Console
• Force.com IDE
• The executeAnonymous Web services API call:
You can utilize incognito blocks to expeditiously evaluate Apex on the fly, such as in the Developer Console or the Force.com IDE, or to indite code that changes dynamically at runtime
Note the following about the content of an incognito block (for executeAnonymous(), the code String):
* Can include utilizer-defined methods and exceptions.
* Utilizer-defined methods cannot include the keyword static.
* You do not have to manually commit any database changes.
* If your Apex trigger consummates prosperously, any database changes are automatically committed. If your Apex trigger does not consummate prosperously, any vicissitudes made to the database are rolled back.
* Unlike classes and triggers, incognito blocks execute as the current utilizer and can fail to compile if the code breaches the utilizer's object- and field-level sanctions.
* Do not have a scope other than local. For example, though it is licit to utilize the ecumenical access modifier, it has no denotement. The scope of the method is inhibited to the innominate block.
* When you define a class or interface (a custom type) in an incognito block, the class or interface is considered virtual by default when the innominate block executes. This is true even if your custom type wasn’t defined with the virtual modifier. Preserve your class or interface in Salesforce to eschew this from transpiring. Note that classes and interfaces defined in an incognito block aren’t preserved in your organization.