Hello,
I have some sql that I want to port over from Postgresql to Oracle but I am having a lot of trouble with it. One thing in particular is using the AVG function with dates. Just to give you an example of what I am tyring to do, in postgresql I use the AGE function to find out the interval between the two dates ex: AGE(creation_date,close_date) but then in a summary query I use AVG(AGE(creation_date,close_date)) which will average all the intervals. How can I do this in Oracle? Here is a small snippet of my sql:
I get an error saying:
ERROR at line 1:
ORA-00932: inconsistent datatypes
Do I have to cast the interval into another datatype? If so, how do I do that?
Thanks for any help you can give.
Later
P.S.
I am using Oracle 9i.
I have some sql that I want to port over from Postgresql to Oracle but I am having a lot of trouble with it. One thing in particular is using the AVG function with dates. Just to give you an example of what I am tyring to do, in postgresql I use the AGE function to find out the interval between the two dates ex: AGE(creation_date,close_date) but then in a summary query I use AVG(AGE(creation_date,close_date)) which will average all the intervals. How can I do this in Oracle? Here is a small snippet of my sql:
Code:
SELECT org,workbasket,task,
AVG(((close_date - creation_date) DAY TO SECOND)),COUNT(task_id)
FROM perfor_view_distinct
GROUP BY org,workbasket,task;
I get an error saying:
ERROR at line 1:
ORA-00932: inconsistent datatypes
Do I have to cast the interval into another datatype? If so, how do I do that?
Thanks for any help you can give.
Later
P.S.
I am using Oracle 9i.