PgSQL functions with rollback and commit
<p>I am trying to convert my MySQL procedure to pgSQL function that uses rollback and commit. When I did I am getting an error like below,</p>

<blockquote>
  <p>ERROR:  cannot begin/end transactions in PL/pgSQL
  HINT:  Use a BEGIN block with an EXCEPTION clause instead.
  CONTEXT:  PL/pgSQL function fun_profile_update(refcursor,character varying,character varying) line 155 at SQL statement</p>
</blockquote>

<p>Please help me out. Here is my function:</p>