Subject | Re: [firebird-support] Disable updates based on field value |
---|---|
Author | ibrahim bulut |
Post date | 2005-03-03T12:40:17Z |
try this,
if (new.f2 is not null) then
begin
new.f3=old.f3;
new.f4=old.f4;
end
if (new.f2 is not null) then
begin
new.f3=old.f3;
new.f4=old.f4;
end
----- Original Message -----
From: "radevojvodic" <vrade@...>
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
>
>
>
>
>
>
>
>