How to write the select query to calculating difference of 2 timestamp fields in oracle 10g based on condition
I have a table which has fields date_of_notification, date_of_loss. Both are of type time-stamp. I have to calculate the TAT base开发者_JAVA百科d on the condition that if date_of_notification is null, then TAT would be current date - date_of_loss and if it is not null, then TAT would be date_of_notification - date_of_loss. How can i write SQL query for this in Oracle 10g. I cannot use procedure.
select nvl(date_of_notification, systimestamp) - date_of_loss from the_table;
精彩评论