EnjoY | Database Research And Development: PostgreSQL : How to Handle Multiple Transactions in PostgreSQL

Wednesday, February 3, 2021

PostgreSQL : How to Handle Multiple Transactions in PostgreSQL

This article is half-done without your Comment! *** Please share your thoughts via Comment ***

Multiple Transactions in PostgreSQL


Note : One Stored Procedure/Function calling multiple stored Procedure/Functions.

Current Situation :

Note: if we are calling multiple stored procedure in one Stored Procedure inside, until complete the execution, before we cannot be able to check the data which is succeed with completed stored procedure, if we any exception occurred in between any of the stored procedure  succeed stored procedure also will rollback.

 

How to handle:

If we are executing nested stored procedure or functions within one SP/Function, with DML operation, if we required succussed stored procedure should do the commit condition.

Do the Commit Condition after stored Procedure?

 

Following below example.

Create or Replace Procedure Multiple_Transaction()

As

$$

Begin

                                    CALL StoredProcedure_1();

                                    Commit;

                                    CALL StoredProcedure_2();

                                    Commit;

                                    CALL StoredProcedure_();

End

$$

Language plpgsql;

No comments:

Post a Comment

It’s all about friendly conversation here at small review :) I’d love to be hear your thoughts!

Be sure to check back again because I do make every effort to reply to your comments here.

Featured Post

SQL Server : SELECT all columns to be good or bad in database system

This article is half-done without your Comment! *** Please share your thoughts via Comment *** In this post, I am going to write about one o...

Popular Posts