aforank
aforank

Reputation: 129

Is it possible to call a stored procedure in a user defined function ?

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

Upvotes: 0

Views: 9838

Answers (1)

Dave Hilditch
Dave Hilditch

Reputation: 5439

You can cheat and call the stored procedure from within a function using SQL Server using extended stored procs or openquery.

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.

Upvotes: 1

Related Questions