문제

I have a sql package here that is trigged when I insert or update one table. This is the critical part where (very simplified)

IF ( UPDATING ) THEN
        IF ( V_OLD_DATE  != V_NEW_DATE ) THEN
                  ---- do stuff

So, it works fine whenever the V_OLD_DATE is filled, however, V_OLD_DATE can be NULL and this is messing with the results of this trigger.

Is there any "cannonical" solution for this situation? The best I could do is a pre cheking of V_OLD_DATE

   IF ( UPDATING ) THEN
                IF ( (V_OLD_DATE is NULL and V_NEW_DATE is not NULL) OR 
                           V_OLD_DATE  != V_NEW_DATE ) THEN
                               ---- do stuff

Thank you

도움이 되었습니까?

해결책

You can use NVL in Oracle. you can visit the link below for details:

https://forums.oracle.com/thread/2186954

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top