Both stored procedures and user-defined functions are created with CREATE FUNCTION statement in PostgreSQL. Then, use the COMMIT SQL keyword to wrap the insertion and update statements within a transaction. One Procedures can issue a commit or rollback and keep processing, Functions can not issue a commit or rollback. From the connection object create a session object which can be used for executing any SQL statement. Finally, on any error, ensure that you rollback the transaction! Double Linked List with smart pointers: problems with insert method. Listing 1. Here is a small sample of how to do it. As requested I have pasted the stored procedure below. Why is it believed that a Muslim will eventually get out of hell? Is there any other way to do it? Execute a Stored Procedure in PostgreSQL. Many reporting tools (Crystal Reports, Reporting Services, BI tools etc.) INSERT Stored Procedure in SQL Server Example. [<