Apex Trigger
trigger OppTrigger on Opportunity (before insert) {
List<Opportunity> oppList =[SELECT Id, Name FROM Opportunity WHERE Name =:Trigger.new[0].Name];
if(oppList.size()!=0){
Trigger.new[0].Name.addError('There is an Opportunity with the same Name. Try another name');
}
}