Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

add a column to query with difference of time between two date columns.

zn553Jun 2 2021

I would like based on this query add a column that will display the time elapsed between the 'eventtime' and the 'time_received:


select a.transaction_id, e.eventcode, e.eventtime, a.time_received
from request_history_tbl a 
   join eventlog_tbl e on a.transaction_id = e.transaction_id
   where e.eventtime >= sysdate - 30
   and e.eventcode = '50'
   order by 3 desc;

the time_received and eventtime are of type date.
how can i add a new column per instance 'elapsed that display the diff in seconds per instance between eventtime and time_received?

This post has been answered by Solomon Yakobson on Jun 2 2021
Jump to Answer

Comments

EdStevens

This really has nothing to do with SQL Developer (the subject of this forum). It is a much better fit in SQL & PL/SQL.
And just as a side comment, storing 'age' as data is a flawed design. The 'age' of everyone and every thing is increasing by the day, if not by the second. What is your plan to keep 'age' current? Better to store 'date of birth' and the calculate 'age' when needed at run-time.

User_H3J7U

The 'age' of everyone and every thing is increasing by the day, if not by the second.
Sometimes the age stops increasing.
изображение.png

EdStevens

Pour me one!
Of course, that's not actually the age, but the amount of time it was 'aged' in the barrel before bottling.

1 - 3

Post Details

Added on Jun 2 2021
2 comments
802 views