DIfference Between Stored Procedures and Prepared Statements?

后端 未结 3 2045
感动是毒
感动是毒 2020-12-04 14:50

What is the difference between Stored Procedures and Prepared Statements... And which one is better and why...!! I was trying to google it but haven\'t got any better articl

3条回答
  •  臣服心动
    2020-12-04 15:05

    A stored Procedure is stored in the DB - depending on which DB (Oracle, MS SQL Server etc.) it is compiled and potentially prepared optimized when you create it on the server...

    A prepared statement is a statement which is parsed by the server and an execution plan is created by the server ready for execution whenever you run the statement... usually it makes sense when a statement is run more than once... depending on the DB server (Oracle etc.) and even sometimes configuration options these "preparation" are either session-specific or "global"...

    There is no "better" when you compare these two since they have their specific use cases...

提交回复
热议问题