存储过程与存储过程之间的差异功能 ? [英] Diff between stored procedure & functions ?

查看:77
本文介绍了存储过程与存储过程之间的差异功能 ?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



谁能告诉我存储过程和功能之间的区别是什么?



为什么我们有类库时会去存储过程?



提前谢谢



Naveen ...

解决方案

您好,

1>程序可以返回 n 函数可以返回一个 必须的值。

2>程序可以输入输出参数 它的功能可以只有输入参数。

3>程序允许选择 作为以及 as DML语句中,而 function 仅允许中选择语句

4>函数可以从
procedure 中调用,但不能调用过程< span class =code-keyword> from function

5>可以通过尝试捕获块 a <处理异常span class =code-keyword> procedure 而try-catch块不能用于 function < /跨度>。

6>我们可以 go 事务管理 procedure 而我们可以' t go in function。

7>程序不能在select语句中使用,而函数可以嵌入在select语句中。


谢谢你Puranjay34



这是一个很好的解释。你在哪里得到这些简单的定义。初学者真​​的很好理解。



你能告诉我为什么我们有类库时会去存储过程?



问候



Naveen ...


如果您正在学习SQL服务器功能,那么为了区别,请参阅此处

Hi all ,

Can anyone tell me whats the difference between stored procedure & functions?

Why do we go for stored procedures when we have class libraries?

Thanks in advance

Naveen...

解决方案

Hi,

1>Procedure can return zero or n values whereas function can return one value which is mandatory.

2>Procedures can have input,output parameters for it whereas functions can have only input parameters.

3>Procedure allow select as well as DML statement in it whereas function allow only select statement in it.

4>Functions can be called from procedure whereas procedures cannot be called from function.

5>Exception can be handled by try-catch block in a procedure whereas try-catch block cannot be used in a function.

6>We can go for transaction management in procedure whereas we can't go in function.

7>Procedures can not be utilized in a select statement whereas function can be embedded in a select statement.


Thank you Puranjay34

that was a good explanation.where do you get these good simple definitions.really good to understand for beginners.

Could you tell me "Why do we go for stored procedures when we have class libraries?"

Regards

Naveen...


If you are taking about SQL server functions, then for a difference, see here.


这篇关于存储过程与存储过程之间的差异功能 ?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆