How do refer to the whole record in triggers
Date: 1996/08/28
Message-ID: <3224DF5B.6C68_at_best.com>#1/1
Hi,
I am very new to oracle (the whole rdbms scene itself). I have a master record and I have to maintain the audit logs for changes done to the master table. This includes any update, insertion and deletions done on the master record. Everything is fine till here, but when I started writing the trigger, I realized that there were two fields in the master tables named "BEGIN" and the other one was "END". (I know, I know, very very bad choice of name for the columns, but I do not have any leeway, in changing them). So when I wrote the trigger, SQL*PLUS gave me a "Warning: compilation of trigger .." (something like that).
I realized the problem, I was referring to the BEGIN and END fields
in the trigger body ( a portion of it follows):
IF INSERTING THEN
insert into master_table_jn
(field1, field2,..., BEGIN, END,...)
values
(:new.field1, :new.field2,...,:new.BEGIN, :new.END,...);
END IF;
If I remove the BEGIN and END column oracle is happy, but if I include
them, it complains ( I think the BEGIN and END screw up the PL/SQL
compiler). My question : Is there any way by which I can refer the
affected record on the whole without specifying its individual fields.
Like for example
IF INSERTING THEN
insert into master_table_jn
values :new.whole_record;
END IF;
If this is not possible, is there anything, short of changing the
column names, solve my probelm. I would appreciate any help on this.
Please post your replies to either the newsgroup or to my email address,
which is anantha_at_best.com
thanks,
anantha
Received on Wed Aug 28 1996 - 00:00:00 CEST