开发者

How to write the select query to calculating difference of 2 timestamp fields in oracle 10g based on condition

开发者 https://www.devze.com 2023-03-28 12:26 出处:网络
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,

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

精彩评论

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