title: What is the proper syntax for PostgreSQL stored procedures (functions)?
body: <p>I'm trying to write two types of stored procedures in PostgreSQL. From what I understand Postgre only has functions. I was wondering if someone can take a look at my code and offer pointers. Also, I'm am not familiar whether with the spacing/new lines of commands.</p>
  
  <p><strong>The first function needs to take input from user and add it onto a table.</strong>
  Suppose we have a table name "Car" with attributes "model" and "year".
  Will this be a correct stored function to add a new car to the table?</p>
  
  <pre><code>CREATE OR REPLACE FUNCTION
      addto_car(model IN Car.model%type, year IN Car.year%type)
  RETURNS
      void
  AS $$
  BEGIN
      INSERT INTO Car VALUES(model, year);
  END;
  $$ LANGUAGE plpgsql; (#Is this correct? I'm using postgresql 9)
  </code></pre>
  
  <p>---------- Work in Progress code
  <strong>Function 1</strong></p>
  
  <pre><code>CREATE OR REPLACE FUNCTION
      addto_car(In model Car.model%type, IN year Car.year%type)
  AS $$
  BEGIN
      INSERT INTO Car VALUES(model, year);
  END;
  $$ LANGUAGE plpgsql;
  </code></pre>
  
  <p>This now works! (inserts values model and year into Car).</p>