是否可以在用户定义的函数中调用存储过程?

是否可以在用户定义的函数中调用存储过程?

问题描述:

是否可以在sql server,mysql或oracle中的用户定义函数中调用存储过程?

Is it possible to call a stored procedure in a user defined function in sql server, mysql or oracle ?

您可以作弊并通常,您希望函数具有确定性-即,在给定相同数据集的情况下,它始终会返回相同的结果.请参阅此有关确定性和非确定性功能的Microsoft文章,以了解限制.

Normally, you want your function to be deterministic - i.e. given the same dataset it always returns the same results. See this Microsoft article on deterministic and non-deterministic functions to understand the restrictions.

这取决于您要处理的内容.您很可能希望在函数内部执行某些本不应该尝试执行的操作,因为您来自程序或非基于集合的编程背景.

It depends on what you want to do with it. There's a healthy chance you want to do something inside your function that you shouldn't be trying to do, because you've come from a procedural or non-set-based programming background.