Apex では、DML を使用してデータベース内のデータの検索、挿入、削除、更新処理を実行できるほか、保存ポイントの作成や編集も行える。

Account[] accounts = new account[] {new Account(name='foo'), new Account(name='bar')};
insert accounts;

Savepoint sp = Database.setSavepoint(); 
delete accounts;
Database.rollback(sp);  // ロールバック