Query: If the total cycle time is coming as negative for some values. We found this was due to the fact that not all Transactions require Senior Portfolio Manager Approval. If Bridge Lease or Short Term Lease is checked on Transaction general tab, then Sr PM Approval is not required. Therefore the total approval cycle time would be from First Approval Initiated Date through Final Approval (latest approval date).
Currently Coded :
when Approval_Legal is not null and APPROVAL_SENIORPM is not null
And Approval_Legal > nvl(Approval_Sent_Seniorpm,to_date('01/01/1900','DD/MM/YYYY')) and Approval_Legal > nvl( APPROVAL_EHS,to_date('01/01/1900','DD/MM/YYYY'))
And Approval_Legal < APPROVAL_SENIORPM
Then Approval_Legal
Else Approval_Sent_Seniorpm End)
Need some change in existing query but how ......please advise