Subject Re: [firebird-support] Doubt with trigger before insert
Author André Knappstein
> ...
> where nfi.registro_id=new.registro_id

assuming that "new.registro_id" is indeed a new ID (not already
existing in the NFI table), I would expect to get an empty resultset
like you actually do.

The Trigger is "BEFORE" insert and is operating on the table
"Notasfiscaisitens" (NFI) which means that the "new.registro_ID"
is not yet inserted into that relation.
Therefore, no record matches the WHERE condition in your case and you
get NULLs.

best regards,
André