Is This Content Helpful?
We're glad to know this article was helpful.
If a database management system (DBMS) attribute contains a default value it does not set because the geodatabase sets the attribute to NULL when performing an insert.
Working with non-versioned classes, a default value for a table's attribute may be defined. When an application inserts a row into the table and the attribute is not referenced in the INSERT statement, the database automatically sets the value of the attribute to the default value.
Since the geodatabase is an object-oriented application, all values are initialized when objects (rows) are created. Attributes that are nullable are set as NULL. Attributes that are not nullable receive initial values so as not to violate the NOT NULL constraint when the row is inserted into the table.
Varchar values are defined as an empty string and integer values are defined as 0.
When the geodatabase sets a NULL value for nullable attributes, the DBMS expects the attribute value to be NULL and therefore does not set the value to the attribute's default value.
Create a trigger on the attribute table to set a value other than NULL during an insert.
The following is an Oracle example for creating a BEFORE INSERT trigger that sets an attribute value during an insert operation:
CREATE OR REPLACE TRIGGER before_insert_parcels
BEFORE INSERT ON parcels FOR EACH ROW
IF :NEW.appraisal_value IS NULL THEN
:NEW.appraisal_value := 0;