Subject Re: [IBO] Beginnig is hard - Triggers and Not NULL
Author TeamIBO
> 1.) You have a db field "Description" which must not be NULL.
> 2.) You have a trigger which sets this field to a computed value if
> the user leave it blank but if the user specifies it the user's
> value is taken.

> The problem seems to be that the field "Description" is allways
> included in the sql insert statement even when NULL and so you are
> running into the "must not be null" exception.

If the before insert/update trigger is setup something like...

IF ( (New.Description IS NULL) OR (New.Description = '') ) THEN
New.Description = 'default value';

then this should be picked up regardless of whether the description
field was included in the insert/update statement or not.

Does this help?

--
Geoff Worboys - TeamIBO
Telesis Computing