This variable returns a list of the old version of sObject records. This list is only available in update and delete triggers.
trigger ApexTrigger on Opportunity (before update)
{
// Only available in Update and Delete Triggers
for(Opportunity oldOpp: Trigger.old)
{
for(Opportunity newOpp: Trigger.new)
{
if(oldOpp.id == newOpp.id && oldOpp.Amount != newOpp.Amount)
newOpp.Amount.addError(‘Amount cannot be changed’); // Trigger Exception
}
}
}