SQL Differences between stored procedure and triggers

前端 未结 13 1325
北荒
北荒 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:41

    A stored procedure is a piece of code that resides in and is executed by the DBMS and can be called explicitly by the client or by other stored procedures. It is usually written in a procedural extension of SQL, such as PL/SQL under Oracle or T-SQL under MS SQL Server, but some DBMSes support more general languages such as Java or .NET as well.

    A trigger is a (sort of) stored procedure that cannot be called explicitly, and instead executes automatically in response to events such as insertion, update or deletion or rows in a table.

    0 讨论(0)
提交回复
热议问题