After Insert trigger

Database
Enthusiast

After Insert trigger

Hello,

I am trying to create the following trigger, which is almost identical to a sample one that Teradata offers in their documentation.  However, I receive the error " CREATE TRIGGER Failed. 5424:  A triggered action statement is the wrong kind. "  Can anyone tell me what is wrong with the trigger?

CREATE TRIGGER workdb.lw_gg_latency_ins

AFTER INSERT ON workdb.lw_gg_latency_tbl

REFERENCING NEW AS NewRow

FOR EACH ROW

(

set NewRow.latency_sec = cast(extract(day from ((NewRow.trg_ins_time - NewRow.src_ins_time) day(3) to second)) +

extract(hour from ((NewRow.trg_ins_time - NewRow.src_ins_time) day(3) to second)) * 24 +

extract(minute from ((NewRow.trg_ins_time - NewRow.src_ins_time) day(3) to second)) * 60 +

extract(second from ((NewRow.trg_ins_time - NewRow.src_ins_time) day(3) to second)) as int)

;

)

Thank you for your assistance.

Linda

Tags (2)
2 REPLIES
Enthusiast

Re: After Insert trigger

The issue is well explained on this page:

http://teradataerror.com/5424-A-triggered-action-statement-is-the-wrong-kind.html

"SET" can only be used in a BEFORE row triggers

Senior Apprentice

Re: After Insert trigger

Well, this is a website which simply copies the error descriptions from Teradata's Messages manual.

http://www.info.teradata.com/HTMLPubs/DB_TTU_15_10/index.html#page/General_Reference/B035_1096_151K/...