in reply to INSERT or UPDATE, but only when unique

If you use Oracle, the  MERGE statement might be a good idea