This is my trigger after update record.
The old.ActivatedDate
always is Null
and new.ActivatedDate
always is not Null
.
This is my code, but it is not working because its condition is not returning true to continue other jobs.
SET @OldActivateDate := OLD.ActivateDate;
SET @NewActivateDate := NEW.ActivateDate;
IF(@NewActivateDate IS NOT NULL AND @OldActivateDate IS NULL AND @OldActivateDate!=@NewActivateDate)
THEN
/* Do Some Functionality */
END IF;
I tested this method also, but again it is not working.
if (@NewActivateDate != @OldActivateDate) and ( @NewActivateDate is not null and @OldActivateDate is null )
THEN
/* Do Some Functionality */
END IF;
If you want to check that old.ActiveDate
should be NULL
and new.ActivateDate
should not be NULL
, then why do you have other conditions. Just use:
IF (@NewActivateDate IS NOT NULL AND @OldActivateDate IS NULL) THEN
. . .
END IF