开发者

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;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜