Skip to Main Content

Change column data is inserted into when running After Insert row level trigger...

FriendlyToooJun 19 2014 — edited Jun 19 2014

Hi Folks:

I am using an AFTER INSERT row trigger in Oracle 11g to copy specific columns from one table to another on insert. I have the trigger and insert working ok. The problem I have is that I need to insert the new data from one column to a different column when copying it.

The trigger info reads:

BEGIN insert into BALES_STORAGE (CROP, CUTTING, DESTINATION, BALES_MOVED, DATE_MOVED, PASTURE, TARGET_LB_PER_DAY) values (:new.CROP, :new.CUTTING, :new.MOVING_LOCATION, :new.BALES_MOVED, :new.DATE_MOVED, :new.PASTURE, :new.TARGET_LB_PER_DAY); END;

The first table is called "BALES_HARVESTED" and the 2nd table the trigger inserts the selected columns into is called "BALES_STORAGE". I need to insert the :new.MOVING_LOCATION data into the column called DESTINATION on the second table.

So my question is: when using an after insert row trigger, how to I change the column that the data is inserted into?

Thanks for any help.

Matthew

Comments
Post Details
Added on Jun 19 2014
2 comments
95 views