title: how to dynamically insert column value into table2 select * from another table1 which is having one column less than table2
body: <p>table1 :</p>
  
  <pre><code>t1_column1  t1_column2  t1_column3
   1           2           3
   2           3           4
  </code></pre>
  
  <hr>
  
  <pre><code>table2 is : 
  
  t2_column1  t2_column2  t2_column3   t2_column4
   1           2           3             0
   2           3           4             0
  </code></pre>
  
  <blockquote>
    <p>Here I am passing the value as function argument, but when I am
    trying to create this function getting this error : Error(11,7):
    PL/SQL: SQL Statement ignored   and Error(11,108): PL/SQL: ORA-00917:
    missing comma</p>
  </blockquote>
  
  <pre><code>CREATE OR REPLACE FUNCTION NEW_PURCHASE(GODOWN_CODE IN VARCHAR2,MON IN 
  VARCHAR2)
     RETURN VARCHAR2 IS
     var_mon VARCHAR2(100);
     PRAGMA AUTONOMOUS_TRANSACTION;
  
  BEGIN
  var_mon:=MON;
  
    INSERT INTO table2  
  ( t2_column1, t2_column2, t2_column3, var_mon)
  SELECT  t1_column1, t1_column2, t1_column3 
  FROM table1   WHERE  t1_column1=GODOWN_CODE;
    DELETE FROM table1 WHERE  t1_column1=GODOWN_CODE;
  
      COMMIT;        
    RETURN 'done';
   END NEW_PURCHASE;
  </code></pre>