Thursday 18 December 2014

What is the difference between a stored procedure and a view?

A stored procedure:
  • accepts parameters
  • can NOT be used as building block in a larger query
  • can contain several statements, loops, IF ELSE, etc.
  • can perform modifications to one or several tables
  • can NOT be used as the target of an INSERT, UPDATE or DELETE statement.
A view:
  • does NOT accept parameters
  • can be used as building block in a larger query
  • can contain only one single SELECT query
  • can NOT perform modifications to any table
  • but can (sometimes) be used as the target of an INSERT, UPDATE or DELETE statement.

No comments:

Post a Comment