Subject | Disable updates based on field value |
---|---|
Author | radevojvodic |
Post date | 2005-03-03T12:09:47Z |
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.
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.