I am new to DB Oracle, When I create a new request in Clarity (that is a project & portfolio management application) or when I change the status of a request, I would like to update the field status
to the new value of mb_status_idea
.
The following query works well in case of Update, but if I create a new request, it does not update the status. (so status is not equal to status MB).
IF ( :old.mb_status_idea != :new.mb_status_idea)
THEN update inv_investments a
set a.status = stat
where a.id=:new.id ;
END IF;
I think the problem is that when creating a new request, since for insert trigger OLD contains NO VALUE, so the condition would be false and it doeas not update the status.
Note: The field status
is in the table INV_INVETMENTS , (stat := :new.mb_status_idea) and database column for status MB is mb_status_idea
I also added this condition --> or (:old.mb_status_idea is null), but again when I create a new request, the value of "Status" and "status MB" are different (status is not updated).
I do appreciate if someone could help to overcome this problem.
All ideas are highly appreciated,
Mona