oracle - Why does my trigger throw ORA-01747? -


i sending startdate value end date, createdby value modifiedby , on specified in code. operation should performed during update information.

ora-01747 : "invalid user.table.column, table.column, or column specification error" in toad

create or replace trigger smts.smts_dr_timings_update_record before update of start_date on smts.smts_dr_timings referencing new new old old each row declare tmpvar number;  begin    begin       update smts_dr_timings        set end_date = :new.start_date,            modified_by = :new.created_by,            modified_datetime = :new.created_datetime       township_code = :new.township_code        ,  dr_id = :new.dr_id        , end_date null ;        exception       when others null;    end;         end smts_dr_timings_update_record; 

can me error? thanx in advance

you can try as

 create or replace trigger smts.smts_dr_timings_update_record    before update of start_date    on smts.smts_dr_timings    referencing new new old old    each row declare    tmpvar   number; begin    begin       if updating ('start_date') , <your logic>        :new.end_date := :new.start_date;       :new.modified_by := :new.created_by;       :new.modified_datetime := sysdate;       end if;    exception       when others                null;    end; end smts_dr_timings_update_record; 

update 1

create or replace trigger test_trg    before update of my_col    on my_table    referencing new new old old    each row declare    tmpvar   number; begin    begin       if updating ('my_col')                :new.creation_date := sysdate;          :new.last_update_date := sysdate;          :new.last_updated_by := 1234;       end if;    exception       when others                null;    end; end test_trg; 

update statement

update my_table set my_col='test update' my_primary_key= 45; 

the above works fine.


Comments