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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

creating triggers

Status
Not open for further replies.

davidrm

Programmer
Joined
Jun 5, 2002
Messages
3
Location
US
To all of you trigger guru's,

I am trying to create a database trigger that does an insert to a table called audit_parts whenever the standard cost of a part has been changed. I have never created a trigger before, and just wanted to get some input on the code.

Create or replace trigger audit_costs
before update on Part
for each row
when (new.std_cost <> old.std_cost)
begin
insert in audit_part
values (:old_std_cost, :new_std_cost, sysdate, :User);

I dont believe that I need to declare a variable to hold the old and new values , but I'm uncertain. Thanks in advance

David

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top