Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I'm trying to write an update trigger that will Design_Update_Status to Customized when a date is entered in Custom_Design_Update_Date field and if nothing is entered that field it should update Design_Update_Status to Standard.

As of now i am using a trigger and this doesnot update the status correctly.

IF NEW.Custom_Design_Update_Date = ''
THEN
SET NEW.Design_Update_Status = 'STANDARD';
else 
SET NEW.Design_Update_Status = 'CUSTOMIZED'; 
END IF;

tried a lot in this, cant figure out a solution. help needed in this regard.

Thanks, Acube.

share|improve this question
    
Should that be NEW.Custom_Design_Update_Date IS NULL ? –  Phil Mar 31 at 16:36
    
i checked with NULL also , it is getting updated with CUTOMIZED not Standard. it always taking the value CUSTOMIZED –  Acube Mar 31 at 16:39
    
The 'NEW.Custom_Design_Update_Date IS NULL' should work as you described. Check the real value of the 'Custom_Design_Update_Date', perhaps it is not NULL –  levitologista Apr 3 at 9:09

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.