Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> comp.databases.oracle -> Help: need avg(timestamp1 - timestamp2), get type error

Help: need avg(timestamp1 - timestamp2), get type error

From: Ariant <ariant23_at_earthlink.net>
Date: 15 Jan 2004 11:30:03 -0800
Message-ID: <7a108ec3.0401151130.25b50118@posting.google.com>


Hi -

I'm trying to query my database to find the min, max and average times (in seconds, or minutes, or something) between two timestamps. I've tried using:

Select avg(timestamp1 - timestamp2) from table;

I get an error saying that avg() expects a number, not an interval. Is there a way (in a SQL stmt) to convert timestamps (or their intervals, if they're different) so that I can run the avg, min, and max functions?

I know that I could easily do this in C++ or Java, but I'm hoping to do all of my calculations in SQL statements, since they will be faster than in Java.

Thanks!
Ariant Received on Thu Jan 15 2004 - 13:30:03 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US