title: How to write update function (stored procedure) in Postgresql?
body: <p>I want to create an <code>update function</code> (stored procedure) in postgresql, I have searched many times on google, but didn't find a proper example of an update function (stored procedure). How can I write an update function in Postgresql and change the existing data in a table?</p>
  
  <p>Thanks in advance. </p>
  
  <pre><code>Example of Function
  
  CREATE OR REPLACE FUNCTION updateuser_login(userloginidp integer, usercategoryidf integer, usertypeidf integer, usertypereferenceidf integer, loginname text, loginpassword text, menutypeidf integer, username text, dashboardconfig text, careprovideridf integer, isactive boolean)
    RETURNS void AS
  $BODY$BEGIN
      UPDATE  tbuserlogin
      SET usercategoryidf="@usercategoryidf", 
          usetypeidf="@usertypeidf", 
          usertypereferenceidf="@usertypereferenceidf", 
          loginname="@loginname", 
          loginpassword="@loginpassword", 
          menutypeidf="@menutypeidf", 
          username="@username", 
          dashboardconfig="@dashboardconfig", 
          careprovideridf="@careprovideridf", 
          isactive="@isactive"
      WHERE   userloginidp = "@userloginidp";
  END$BODY$
    LANGUAGE plpgsql VOLATILE
    COST 100;
  ALTER FUNCTION updateuser_login(integer, integer, integer, integer, text, text, integer, text, text, integer, boolean)
    OWNER TO postgres;
  </code></pre>