I'm trying to create a trigger in DB2 that will prevent any one from updating any personal information that does not belong to them I.E. FIRST_NAME, LAST_NAME, EMAIL , PHONE_NUMBER columns. I'm trying to make it so individuals are the only ones allowed to update their own personal information by username I.E. the current user can only update information associated with the current username. What is the proper syntax for creating this trigger, I am struggling to get it right.

  • 2
    show your current code
    – Charles
    Oct 17 '19 at 20:14
  • Hey Charles, I am a student, so other than creating and naming the trigger, adding the table, and columns I am kind of at a loss as to how to make the trigger check the username against the information being added Oct 17 '19 at 20:20
  • 1
    Documentation contains multiple examples of triggers for various purposes.
    – mustaccio
    Oct 17 '19 at 20:56

If it's not some educational task or quiz with trigger use in Db2, then it's better to use Row and column access control (RCAC) for such a goal.

Not the answer you're looking for? Browse other questions tagged or ask your own question.