Subject Re: [firebird-support] Validation error
Author Thomas Steinmaurer
Hello,

> Im using FB 2.0.x.
>
> I have the following message on a Database
>
> ISC 335544347
> validation error for column ChangeRef, value "*** null ***"
> At trigger 'Pi_Fel_voucher_Status_chg'
> At trigger 'Pi_Fel_BookingStatusChange"
>
>
> The first trigger inserts into a table whose PK is ChangeRef, the second
> updates an existing field in that same table (not ChangeRef).
> The insert trigger does NOT set ChangeRef. This is handled by a trigger
> in the destination table itself and is shown below...
>
> AS BEGIN
> IF (NEW.ChangeRef IS NULL) THEN
> NEW.ChangeRef = GEN_ID(Pi_Fel_StatusChange_Gen, 1);
>
> IF (NEW.ChangeDate IS NULL) THEN
> NEW.ChangeDate = CURRENT_TIMESTAMP;
>
> IF (NEW.ActualChangeDate IS NULL) THEN
> NEW.ActualChangeDate = CURRENT_TIMESTAMP;
> END
>
>
>
> Does anybody have any ideas of what could be causing this issue? I have
> other dbs with (I believe) the exact same structure (as they are
> created from the same SQL script.
>
> What should I be looking for?

Can you send the entire DDL of the triggers in question:
Pi_Fel_voucher_Status_chg and Pi_Fel_BookingStatusChange.

Perhaps the firing order of the trigger is messed up, e.g. the trigger,
which is setting the PK value fires after other triggers which also use
the ChangeRef field.



--
With regards,

Thomas Steinmaurer
Upscene Productions
http://www.upscene.com
http://blog.upscene.com/thomas/

Download LogManager Series, FB TraceManager today!
Continuous Database Monitoring Solutions supporting
Firebird, InterBase, Advantage Database, MS SQL Server
and NexusDB!