Stored Procedures Vs. Views

前端 未结 7 1433
难免孤独
难免孤独 2020-12-07 16:26

I have used both but what I am not clear is when I should prefer one over the other. I mean I know stored procedure can take in parameters...but really we can still perform

相关标签:
7条回答
  • 2020-12-07 17:11

    Two rationales.

    Use stored procedure instead of view if you don't want insertion to be possible. Inserting in a view may not give what it seems to do. It will insert in a table, a row which may not match the query from the view, a row which will then not appear in the view; inserted somewhere, but not where the statement make it seems.

    Use a view if you can't use the result of a stored procedure from another stored procedure (I was never able to make the latter works, at least with MySQL).

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