yes, such a trigger is what i want,
however, what if when you check

select deptname into deptname from dept where
dept.deptname = :new.empname;

you found nothing and just then somebody insert a new
record with the same value?