Problems with DEFAULT column
Posted in 1997
I'm trying to ensure that a field in a table which is restricted to
being either 0 or 1 is never left with a NULL value. However, the
default assignment on the appropriate attribute. Even if I have
specified a default value for the attribute, other applications, such as
forms and some generated ESQL insert statements always seem to ensure
that the field has a NULL value.
For example, I have altered the table with the following command:
alter table historic_datamodify fault_view integer default 0
If I attempt to datafill the table using the Informix LOAD command and
leave the fault_view field as NULL in the data file, then each record
created during the load will have a NULL value in fault_view. The
desired behaviour would be to have fault_view set to 0 even if the LOAD
caommand is used to data fill the table.
Does anyone know the syntax for a trigger that would reset the value
of the fault_view field BEFORE it was inserted into the table? Is a
trigger the answer or is there a better mechanism?
--
Rob Hale
Software Designer - Nortel Network Services Management
www http://www.nortel.com/broadband/dms/networks/
mailto:robert_hale@nortel-nsm.com | When in doubt,
(604) 244 - 4255 | peddle like mad !
O
/\\_`
_4\\--\\_
//\\_\\//\\\\
____\\_/_ `\\_/______