create trigger save_history after delete on checked_out
	referencing old as removed_row
	for each row mode db2sql
		when (not exists
			(select borrower_id, call_number from borrhist
				where borrower_id = removed_row.borrower_id and
				      call_number = removed_row.call_number))
		insert into borrhist
		values (removed_row.borrower_id, removed_row.call_number);
		