title: How to insert multiple rows using a function in PostgreSQL
body: <p>I want to insert more than one row in a table with function in PostgreSQL.</p>
  
  <p>This is my table</p>
  
  <pre><code>CREATE TABLE mahasiswa
  (
    nim CHAR(10),
    nama VACHAR(40)
    CONSTRAINT pk_nim PRIMARY KEY (nim)
  )
  ;
  </code></pre>
  
  <p>and this is the function I created</p>
  
  <pre><code>CREATE FUNCTION insertdata(CHAR(10),varchar(40)) 
         RETURNS VOID AS 
         $$ 
           INSERT INTO mahasiswa VALUES ($1,$2); 
         $$ 
         LANGUAGE 'sql';
  </code></pre>
  
  <p>When I call the function like this</p>
  
  <pre><code>SELECT insertdata ('1234567890','Nahrun'),
  ('0987654321','Hartono');
  </code></pre>
  
  <p>only one row is inserted.</p>
  
  <p>How can I modify my function to insert more than one row at a time?</p>