Home > Software design >  Execute a stored procedure inside user defined function
Execute a stored procedure inside user defined function

Time:09-13

I want to execute a few diferents store procedure in a ACID transaction but it can't do only with stored procedures, so I want to know if there is a way to execute stored procedures inside UDF in CosmosDB

CodePudding user response:

That is not possible. Stored Procedures can be invoked from a client only, not from a user defined function.

You cannot chain multiple Stored procedure executions in the same transactional scope either.

The only alternative, depending on what your stored procedures do, would be to use Transactional Batch, so define a group of item operations as a single transaction unit, the limitation is that these are operations that cannot be feedback from one another (you cannot put a Read operation with a condition to perform a Write operation in the same batch, batches do not support conditions), so it really depends on the logic of your stored procedures. Transactional batch cannot be invoked from user defined functions, only from the client.

  • Related