Subject | Re: [ib-support] Trigger - Column Unknown |
---|---|
Author | Milan Babuskov |
Post date | 2003-03-29T10:07:16Z |
gorepj wrote:
database to know which record do you want from table BALANCE ?
Perhaps you should do:
select SUMOFNET_CHANGE
from BALANCE
where ??? = ??? <- connection between CURRENTACCOUNT and BALANCE
into :sumofnet_change;
IF (sumofnet_change IS NULL) THEN
...
Don't forget to declare "sumofnet_change" variable.
HTH
--
Milan Babuskov
http://fbexport.sourceforge.net
> Hi,You have created the trigger for CURRENTACCOUNT. How do you expect
> I'm trying to create a trigger but I keep getting Column Unknown
> error.
>
> SET TERM ^ ;
> CREATE TRIGGER UPDATE_BALANCE_POSTINSERT FOR CURRENTACCOUNT
> AFTER INSERT AS
> BEGIN
> if (BALANCE.SUMOFNET_CHANGE IS NULL) THEN
> INSERT INTO BALANCE (SUMOFNET_CHANGE) VALUES (new.debit -
> new.credit);
> ELSE
> UPDATE BALANCE SET SUMOFNET_CHANGE = SUMOFNET_CHANGE +
> new.debit - new.credit;
> END ^
> SET TERM ; ^
>
>
> The Error is associated with BALANCE.SUMOFNET_CHANGE where BALANCE
> is another Table in the same database.
database to know which record do you want from table BALANCE ?
Perhaps you should do:
select SUMOFNET_CHANGE
from BALANCE
where ??? = ??? <- connection between CURRENTACCOUNT and BALANCE
into :sumofnet_change;
IF (sumofnet_change IS NULL) THEN
...
Don't forget to declare "sumofnet_change" variable.
HTH
--
Milan Babuskov
http://fbexport.sourceforge.net