Teradata substitute to TRUNCATE command

Database
Enthusiast

Teradata substitute to TRUNCATE command

HI

I have a table "table1" and a delete trigger created on that table, which populates "table2"

In oracle when we use TRUNCATE command on "table1" we get no rows inserted in "table2", whereas in teradata for each row, delete trigger inserts a row on "table2".
I have tried " DELETE ALL "
" DELETE FROM "

Is there a similar kind of command i can use in Teradata for above setup, so that rows are not inserted on DELETE ALL.

Thanks
3 REPLIES
Teradata Employee

Re: Teradata substitute to TRUNCATE command

Are you using row-level trigger or a Teradata Triggered Statement ?
Enthusiast

Re: Teradata substitute to TRUNCATE command

Yes, am using Row Level trigger

create deltrig1 after delete on deltest1
REFERENCING OLD AS old_row
for each row (insert into deltest2 values(old_row."key",'row delted');)
Junior Contributor

Re: Teradata substitute to TRUNCATE command

You should always try to rewrite a row trigger to a statement trigger, which is much faster.

ALTER TRIGGER foo DISABLED;
DELETE FROM tab;
ALTER TRIGGER foo ENABLED;

Dieter