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!

Sql to get average timestamp between 2 timestamps

ysriJan 2 2014 — edited Jan 2 2014

I know similar question has been asked many times in several forums. Most of them dealt with fetching interval or difference between timestamps in numbers (hours, mins,...) or using PL/SQL or custom functions.

Without using PL or custom functions, but just a sql what's the most efficient way of calculating timestamp that's half way between 2 timestamps?

alter session set nls_date_format = 'YYYY-MM-DD HH24:MI:SS';

select
to_date('2013-12-05 04:30:20','YYYY-MM-DD HH24:MI:SS') start_date,
to_date('2013-12-06 15:00:30','YYYY-MM-DD HH24:MI:SS') end_date,
'' avg_date
from dual;

Thanks,

-srinivas y.

This post has been answered by Martin Preiss on Jan 2 2014
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 30 2014
Added on Jan 2 2014
2 comments
1,152 views