I have tired to create a trigger like this, but it shows this error Answer This error indicates that your query SELECT DNAME INTO DeptName … returns more than one record, hence its result cannot be assigned to a scalar variable. The problem with your query is that you have an unecessary JOIN on purchase, so it returns one record