title: Triggers adding rows
body: <p>I'm trying to create triggers that add rows in a tab when another tab is updated.</p>
  
  <p>I would like to know if my things are correct. I use Oracle and Java. </p>
  
  <pre><code>statmnt.executeQuery("CREATE TABLE operations
                              ( operation_id INTEGER, 
                                account_id INTEGER, 
                                amount FLOAT DOUBLE PRECISION, 
                                 DATE NOT NULL");
  
   statmnt.executeQuery("CREATE TABLE accounts 
                         ( account_id INTEGER, 
                            name VARCHAR2 (45 CHAR) NOT NULL, 
                           balance FLOAT DOUBLE PRECISION)"); 
  
   statmnt.executeQuery("ALTER TABLE accounts 
                        ADD CONSTRAINT accounts_PK PRIMARY KEY 
                        ( accounts_id )");
  
  statmnt.executeQuery("ALTER TABLE operations 
                        ADD CONSTRAINT accountID FOREIGN KEY 
                     ( operation_accountID "+ "REFERENCES accounts 
                     ( account_id ) ON");  
  
  statmnt.executeQuery("CREATE TRIGGER addingOrder 
                        BEFORE UPDATE ON accounts 
                         BEGIN"
                       + "INSERT INTO operations
                           (operation_id, account_id, amount, date) "
                       + "VALUES (operationID.nextval, :OLD.account_id,
                        :NEW.accounts - :OLD.account, GETDATE()) END;");
  </code></pre>