Home » SQL & PL/SQL » SQL & PL/SQL » Trigger help
Trigger help [message #316686] Sun, 27 April 2008 18:40 Go to next message
iceluvr1089
Messages: 2
Registered: April 2008
Junior Member
Hey I am trying to create a trigger for a table so that when I update or add a record on my invoice line table, it will automatically calculate the new line total. Thought I had to code right, but something is wrong. Can anyone help me?

The code for my trigger is:

CREATE OR REPLACE TRIGGER LINE_TOTAL_T
BEFORE INSERT ON LINE
FOR EACH ROW
BEGIN
NEW.LINE_TOTAL:= :NEW.LINE_UNITS * :NEW.LINE_PRICE;
END;


The errors displaying are:
LINE/COL ERROR
2/2 PL/SQL: Statement ignored
2/2 PLS-00201: identifier 'NEW.LINE_TOTAL' must be declared


Any thoughts??

Thanks!
Re: Trigger help [message #316690 is a reply to message #316686] Sun, 27 April 2008 19:16 Go to previous messageGo to next message
iceluvr1089
Messages: 2
Registered: April 2008
Junior Member
Never mind! I was missing a silly colon in front of new.line_total.
thanks
Re: Trigger help [message #316691 is a reply to message #316686] Sun, 27 April 2008 19:16 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
>Any thoughts??
'NEW.LINE_TOTAL' must be declared
Re: Trigger help [message #316723 is a reply to message #316686] Mon, 28 April 2008 01:15 Go to previous message
dr.s.raghunathan
Messages: 540
Registered: February 2008
Senior Member
hi

you want to update, whereas your before trigger do not have
update syntax it is having only insert...

or am i missing part of your code?

yours
dr.s.raghunathan

Previous Topic: create job get full export
Next Topic: date time parameter
Goto Forum:
  


Current Time: Tue Feb 11 10:14:46 CST 2025