Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: New to Triggers - Help Please -
Sheesh I admire your ability to move on. I would be obsessed to the
point of losing sleep until I figured out what was going on :-) Anyway
might I make one more suggestion to you. The code you have posted is
missing the colons ":" It should read
IF (:OLD.outcome = 14500) AND
(:NEW.outcome) IN (11000,12000,11001) THEN
:NEW.outcome := 14500
END IF;
Notice the colons in front of NEW and OLD.
I just noticed another problem. The assignment operator also needs to
have a colon.
:NEW.outcome = 14500 is a comparison
:NEW.outcome := 14500 is an assignment (notice the colon).
One additional point your trigger must have the following syntax:
REFERENCING NEW AS NEW OLD AS OLD This is basically telling you what you reference each version of the record as.
Happy Coding,
David Archer
In article <wDyy3.2904$9e4.22544611_at_IRIS>,
"Mike M." <okana_at_msn.com> wrote:
> Thanks to everyone who offered assistance - I don't know why but the
trigger
> just would not work - I even had a second pair of eyes look at it,
check the
> syntax and everything. I just handled it in code instead.
>
> Mike
>
> Mike M. <okana_at_msn.com> wrote in message
news:G9Bx3.1487$Kuf.6225975_at_IRIS...
> > I am just starting to write my own triggers and I have a big project
ahead
> > of me that may involve several of them - I already have several that
> > evaluate and assign values upon inserts - those were a piece of cake
- but
> > now I'm dealing with data validation.
> >
> > Here is the first one - and I'm not sure where the error is,
actually I'm
> > not even sure I'm doing it right.
> >
> > I was using the GUI to try and design it, but a SQL statement will
work
> fine
> > if I someone wants to assist me -
> >
> > Oracle 8.05 on NT4
> >
> > Table: Customers
> > Column: OUTCOME
> >
> > Before update on row: if old.outcome = 14500 and new.outcome in
(11000,
> > 12000, 11001) then new.outcome = 14500
> >
> > In other words, if the new outcome code is 11000, 12000 or 11001
then
> don't
> > change it. And I don't need an error raised to the user.
> >
> > Some assistance would be greatly appreciated -
> >
> > Mike
> > mikem_at_msamail.com
> > okana_at_msn.com
> >
> >
> >
> >
> >
> >
>
>
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
Received on Mon Aug 30 1999 - 13:38:33 CDT
![]() |
![]() |