undelete record in salesforce apex

We can retrieve the records from recycle bin i.e the records which are deleted and are present in recycle bin. For example following query retrieves all the account records from recycle bin
   [select id from account where isdeleted =: true ALL rows];
We can also undelete the records retrieved from recycle bin in apex
An example that retrieves the account records from recycle bin and then undeletes them.
Visualforce Page
Controller

1 comment: