Insert row in another table when insert in first table by trigger?
<p>I am trying to insert one row every time in <code>stud_report</code> table whenever I insert row in <code>stud_master</code> table. for that I have tried following SQL code with the help of triggers but I am getting:</p>

<blockquote>
  <p>Warning: Trigger created with compilation errors.</p>
</blockquote>

<pre><code>CREATE OR REPLACE TRIGGER trg
      AFTER INSERT ON stud_master
     FOR EACH ROW
    DECLARE
      roll number;
      sum number;
      per decimal(5,2);
   BEGIN
        roll := stud_master.roll_no;
        sum :=  stud_master.sub1+stud_master.sub2+stud_master.sub3;
        per := (0.33*(sum));
        insert into stud_report values (roll,sum,per);
   END;
   /
</code></pre>

<p>Stud_master table contains </p>

<pre><code>+---------+--------------+----------+
| Field   | Type         | Null?    |
+---------+--------------+----------+
| roll_no | number       | NOT NULL |
| name    | varchar2(15) |          |
| sub1    | number       |          |
| sub2    | number       |          |
| sub3    | number       |          |
| Address | varchar2(30) |          |    
+---------+--------------+----------+
</code></pre>

<p>Stud_report table contains </p>

<pre><code>+------------+--------------+----------+
| Field      | Type         | Null?    |
+------------+--------------+----------+
| roll_no    | number       | NOT NULL |
| total      | number       |          |
| percentage | decimal(5,2) |          |
+------------+--------------+----------+
</code></pre>

<p>Compilation errors are:</p>

<blockquote>
  <p>8/26     PLS-00103: Encountered the symbol ")" when expecting one of the
           following:<br>
           (<br>
  9/49     PLS-00103: Encountered the symbol "," when expecting one of the
           following:<br>
           (<br>
  10/7     PLS-00103: Encountered the symbol "end-of-file" when expecting
           one of the following:<br>
           ;</p>
</blockquote>