title: Can I copy :OLD and :NEW pseudo-records in/to an Oracle stored procedure?
body: <p>I have an <code>AFTER INSERT OR UPDATE OR DELETE</code> trigger that I'm writing to store every record revision that occurs in a certain table, by copying the <code>INSERT</code> and <code>UPDATE</code> <code>:NEW</code> values into a mirror table, and for <code>DELETE</code> the <code>:OLD</code> values.</p>
  
  <p>I could un-clutter my code considerably by conditionally passing either the <code>:NEW</code> or <code>:OLD</code> record into a procedure which would then do the insert into my history table.  Unfortunately I cannot seem to find a way to pass the entire <code>:OLD</code> or <code>:NEW</code> record.</p>
  
  <p>Am I missing something or is there no way to avoid enumerating every <code>:NEW</code> and <code>:OLD</code> column as I invoke my insert procedure?</p>
  
  <p>I want to do the following:</p>
  
  <pre><code>DECLARE
    PROCEDURE LOCAL_INSERT(historyRecord in ACCT.ACCOUNTS%ROWTYPE) IS
    BEGIN
      INSERT INTO ACCT.ACCOUNTS_HISTORY (ID, NAME, DESCRIPTION, DATE) VALUES (historyRecord.ID, historyRecord.NAME, historyRecord.DESCRIPTION, SYSDATE);
    END;
  BEGIN
    IF INSERTING OR UPDATING THEN
      LOCAL_INSERT(:NEW);
    ELSE --DELETING
      LOCAL_INSERT(:OLD);
    END IF;
  END;
  </code></pre>
  
  <p>But I'm stuck doing this:</p>
  
  <pre><code>DECLARE
    PROCEDURE LOCAL_INSERT(id in ACCT.ACCOUNTS.ID%TYPE,
                           name in ACCT.ACCOUNTS.NAME%TYPE,
                           description in ACCT.ACCOUNTS.DESCRIPTION%TYPE) IS
    BEGIN
      INSERT INTO ACCT.ACCOUNTS_HISTORY (ID, NAME, DESCRIPTION, DATE) VALUES (id, name, description, SYSDATE);
    END;
  BEGIN
    IF INSERTING OR UPDATING THEN
      LOCAL_INSERT(:NEW.ID, :NEW.NAME, :NEW.DESCRIPTION);
    ELSE --DELETING
      LOCAL_INSERT(:OLD.ID, :OLD.NAME, :OLD.DESCRIPTION);
    END IF;
  END;
  </code></pre>
  
  <p>Okay, so it doesn't look like a big difference, but this is just an example with 3 columns rather than dozens.</p>