SQL Differences between stored procedure and triggers

前端 未结 13 1467
北荒
北荒 2021-01-30 20:38

I\'m having trouble understanding the difference between a stored procedure and a trigger in sql. If someone could be kind enough to explain it to me that would be great.

<
13条回答
  •  难免孤独
    2021-01-30 21:20

    Think of a stored procedure like a method in an object-oriented programming language. You pass in some parameters, it does work, and it can return something.

    Triggers are more like event handlers in an object-oriented programming language. Upon a certain condition, it can either (a) handle the event itself, or (b) do some processing and allow for the event to continue to bubble up.

提交回复
热议问题