Triggers in TeraData

Ratings:
(4)
Views: 0
Banner-Img
Share this blog:

Triggers

Perform actions based on the event, that event is inserting, delete, update operations on tables.

Based on the actions, there are 2 types of triggers.

  • Before Trigger
  • After Trigger

a) Before trigger

Here action first, event next.

b) After Trigger

The event first, action NEXT.

Trigger applied at  2 Levels.

  1. ROW Level
  2. Statement Level

Note - In Tera data V2R5.1 onwards before trigger does not support

Inclined to build a profession as Teradata Developer? Then here is the blog post on, explore Teradata Training

Example

Create trigger< trigger name>()

Replace trigger< trigger name>()

Drop trigger< trigger name>

Help trigger< trigger name>

SHOW trigger< trigger name>

Alter trigger< trigger name>DISABLED

ALTER trigger< trigger name>ENABLED

2Create trigger< trigger name> Alter update of (column name)

ON<Table Name>Referencing OLD TALE AS OLD TABLE NEW VABLE AS NEW TABLE.

For each statement/Row

[Where condition]

(Trigger Action)

Example

Create Trigger Vinay after update of (party income) on party for each statement

(Insert into test(11,’Record update’,’00001’););

SHOW Trigger Vinay

Update party set party income=99999 where party id=2

Teradata Interview Questions

Example

Create table Translog

OLDVALU INTEGER,

NEW VALUE  INTEGER,

Record date format’ yyyy-mm-dd’ USE-UPDATED

Varchar (50)Default user

Create trigger Tr log

After update of(party income) on party

Referencing OLD AS O New AS N For Each Row

When(N. Party name>10000)

(Insert into translog (o. party income, N. party income, current-date);)

2update party set party income=40000 where party id =2

Limitations

We cannot use the below statement in the trigger body

Select statement to return as Result

Exception Handling

BEGIN And END Statements

COMMIT

DDL And DCL Statements

For In-depth knowledge on Teradata click on:

 

You liked the article?

Like: 0

Vote for difficulty

Current difficulty (Avg): Medium

EasyMediumHardDifficultExpert
IMPROVE ARTICLEReport Issue

About Author

Authorlogo
Name
TekSlate
Author Bio

TekSlate is the best online training provider in delivering world-class IT skills to individuals and corporates from all parts of the globe. We are proven experts in accumulating every need of an IT skills upgrade aspirant and have delivered excellent services. We aim to bring you all the essentials to learn and master new technologies in the market with our articles, blogs, and videos. Build your career success with us, enhancing most in-demand skills in the market.