Subject Re: Disable updates based on field value
Author radevojvodic
Thanks Ibrahim,

That will probably work. The only problem with that solution is that
end-user will complete his task and the value wouldn't change so he
(she) would imidiately call for support because something is not
right. I wanted to put an exception to let the users know that their
action is not allowed. But, even this solution is better then one i
had before, so thanks anyway.

Rade

--- In firebird-support@yahoogroups.com, "ibrahim bulut"
<i.bulut@i...> wrote:
> try this,
>
> if (new.f2 is not null) then
> begin
> new.f3=old.f3;
> new.f4=old.f4;
> end
>
>
> ----- Original Message -----
> From: "radevojvodic" <vrade@i...>
> To: <firebird-support@yahoogroups.com>
> Sent: Thursday, March 03, 2005 2:09 PM
> Subject: [firebird-support] Disable updates based on field value
>
>
> >
> >
> > Hi All,
> >
> > I have a problem with trigger definition. Suppose i have a table
> > with fields F1, F2, F3, F4. I want to disable updates of fields
F3
> > and F4 if Field F2 is not null. And I want to Disable all
updates if
> > Field F1 is not null. Second condition is easy to acomplish but
the
> > firs one gives me trouble. It is OK if F3 and F4 have values: i
just
> > compare new.F3 <> old.F3 and new.F4 <> old.F4 but if old.F3 or
> > old.F4 are null values then trigger does not fire.
> >
> > before update trigger body looks like this:
> >
> > if (old.F1 is not null) then
> > Exception EX1;
> >
> > if (old.F2 is not null) then
> > begin
> > if (new.F3 <> old.F3 or new.F4 <> old.F4) then
> > Exception EX2;
> > end
> >
> > does anyone have (a simple) solution to this problem?
> >
> > Rade.
> >
> >
> >
> >
> >
> >
> > Yahoo! Groups Links
> >
> >
> >
> >
> >
> >
> >
> >