Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to write trigger on a table which insert record in itself.

Status
Not open for further replies.

917122533539

Programmer
Mar 26, 2003
1
IN
HI,

I am facing some problems while writting database trigger in
Firebird database.
My basic requirement is to insert record into table on which i am
writing update trigger.
In Oracle i have written row leve trigger and statment level
trigger
to achieve this.
Ex :
Say I want to insert record into TABLE1 on update of same table.
on update of TABLE1 i am going to insert record in PL/SQL package
.
which will be used to AFTER UPDATE STATEMENT LEVEL trigger on same
table to insert record into TABLE1.

Same thing i want in interbase/Firebird. I would like to know how
it can be acheived?

I have tried in interbase by writing
AFTER UPDATE TRIGGER on TABLE1 and tried to insert record with old
values on TABLE1

Ex:
create trigger upd... for TABLE1 ...
AFTER UDPATE..
BEGIN
INSERT INTO TABLE1 VALUES(OLD.N, OOLD.NAME);
END

But on update of TABLE1 it goes on updating and never terminate.
May be it goes into infinite loop. Ultimately i have to stop the
firebird service . otherwise it go on increasing database file
size.
I would highly appreciate if you can suggest me any good
solution.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top