Subject | Re: [firebird-support] Update more than one column in only one row with a trigger: |
---|---|
Author | Kanka sumatra |
Post date | 2009-08-01T21:45:23Z |
Have you tried this:
as
begin
if (old.field_a is null and new.field_a> 0) then
update table_2
set (new.field_b) = (select field_2 from table_1),set ( new.field_c) = (select field_3 from table_1)
where field_1 = new.field_a) ;
end
--kqj
as
begin
if (old.field_a is null and new.field_a> 0) then
update table_2
set (new.field_b) = (select field_2 from table_1),set ( new.field_c) = (select field_3 from table_1)
where field_1 = new.field_a) ;
end
--kqj
--- On Fri, 7/31/09, fridge_n <fridge_n@...> wrote:
From: fridge_n <fridge_n@...>
Subject: [firebird-support] Update more than one column in only one row with a trigger:
To: firebird-support@yahoogroups.com
Date: Friday, July 31, 2009, 6:51 PM
Probably it is a newbie question but after hours of surfing and trying I hope somebody can help me.
I want to update two columns in one row out of a different table with a before update trigger.
What I can create is an update of one column in one row.
Beneath is what I have used:
>as
>begin
>if (old.field_a is null and new.field_a> 0) then
> update table_2
>set new.field_b = (select field_2 from table_1
>where field_1 = new.field_a) ;
>end
I would expect that the next sample would work, but it doesn't.
>as
>begin
>if (old.field_a is null and new.field_a> 0) then
>update table_2
>set (new.field_b, new.field_c) = (select field_2, field_3 from table_1
>where field_1 = new.field_a) ;
>end
I can't compile it, the error start at the “(” after set. I really haven't got a clue.
Could anybody help.
Thanks in advance,
fridge_n
[Non-text portions of this message have been removed]