I need help on trigger, I am trying to add a default value if the new value is null.
for ex: tab1(col1 varchar2(10), col2 datetime, col3 decimal(5,0))
I want a trigger to execute after insert of each row if col3 is null, then default both col2 = current year to sec and col3 = 100.
I am new to informix and dont know much about triggers, any help would be appreciated.
We use informix 7.31 on a aix box.
I have written something but doesnt work,
CREATE TRIGGER TRG_CC_CIVIL_AI
INSERT ON CC_CIVIL_HEADER
REFERENCING NEW AS NEW
AFTER FOR EACH ROW
( UPDATE CC_CIVIL_HEADER
SET CREATION_DATE = CURRENT,
CREATED_BY = 101
WHERE CAUSE = NEW.CAUSE
AND CREATION_DATE IS NULL);
for ex: tab1(col1 varchar2(10), col2 datetime, col3 decimal(5,0))
I want a trigger to execute after insert of each row if col3 is null, then default both col2 = current year to sec and col3 = 100.
I am new to informix and dont know much about triggers, any help would be appreciated.
We use informix 7.31 on a aix box.
I have written something but doesnt work,
CREATE TRIGGER TRG_CC_CIVIL_AI
INSERT ON CC_CIVIL_HEADER
REFERENCING NEW AS NEW
AFTER FOR EACH ROW
( UPDATE CC_CIVIL_HEADER
SET CREATION_DATE = CURRENT,
CREATED_BY = 101
WHERE CAUSE = NEW.CAUSE
AND CREATION_DATE IS NULL);