Subject Re: Inserted record has wrong value
Author Edward
<quote>
You mention that when you re-read the record, that COMPOUNDGROWTH is
'F'. The log that you showed didn't show the SELECT, only the UPDATE,
after the insert was performed. Also, do you have any insert triggers
on that table, and if you do, can you show them?
</quote>

I looked at the table in IBExpert after the record was inserted (seeing the same result in my app and checked that it was not reading the value incorrectly), so there was no log. Let me know if you want it.

The table has 2 triggers: before insert & before update

Before insert trigger:

CREATE OR ALTER TRIGGER TRIG_KNOWNINCOMEINFO_BI FOR KNOWNINCOMEINFO
ACTIVE BEFORE INSERT POSITION 0
as BEGIN
IF(NEW.KNOWNINCOME_ID IS NULL) THEN NEW.KNOWNINCOME_ID =
GEN_ID(GEN_KNOWNINCOME_ID,1);
execute procedure ClientInfoChanged(New.CLIENT_ID);
END

Note that ClientInfoChanged proc updates a timestamp on the master table for the client info changed (see below).


The before update trigger is here:

CREATE OR ALTER TRIGGER TRIG_KNOWNINCOMEINFO_BU FOR KNOWNINCOMEINFO
ACTIVE BEFORE UPDATE POSITION 0
as BEGIN
execute procedure ClientInfoChanged(New.CLIENT_ID);
END


Here is the DDL for ClientInfoChanged proc:

create or alter procedure CLIENTINFOCHANGED (
CLIENTID integer)
as
BEGIN
UPDATE CLIENTINFO SET UPDATED_DATETIME = CURRENT_TIMESTAMP WHERE CLIENT_ID = ? /* CLIENTID */ ;
END^