I am trying to use the add command function of the database expert. I am using Crystal 2008 and trying pull data from an Oracle DB. I have the following SQL query that works.
[select sum(a.OPEN), sum(b.CLOSED) FROM
(Select SC.INCIDENTSM1.OPENED_BY AS ANALYST, Count(*) AS OPEN FROM SC.INCIDENTSM1
WHERE (SC.INCIDENTSM1.Entry_Point = 11) AND
not (SC.INCIDENTSM1.CATEGORY = 'FACILITIES') and
not (SC.INCIDENTSM1.CATEGORY = 'BUILDING SERVICES') and
(SC.INCIDENTSM1.OPEN_TIME BETWEEN new_time(to_date ('2009-07-14 00:00:01', 'yyyy-mm-dd HH24:MI:SS'),'CST','GMT')
AND new_time(to_date ('2009-07-14 23:59:59','yyyy-mm-dd HH24:MI:SS'),'CST','GMT')) GROUP BY SC.INCIDENTSM1.OPENED_BY) a,
(Select SC.INCIDENTSM1.OPENED_BY AS ANALYST, Count(*) AS CLOSED FROM SC.INCIDENTSM1
WHERE (trunc(SC.INCIDENTSM1.CLOSE_TIME) = trunc(SC.INCIDENTSM1.OPEN_TIME))
AND (SC.INCIDENTSM1.CLOSED_BY = SC.INCIDENTSM1.OPENED_BY)
AND (SC.INCIDENTSM1.Entry_Point = 11) AND
not (SC.INCIDENTSM1.CATEGORY = 'FACILITIES') and
not (SC.INCIDENTSM1.CATEGORY = 'BUILDING SERVICES') and
(SC.INCIDENTSM1.OPEN_TIME BETWEEN new_time(to_date ('2009-07-29 00:00:01', 'yyyy-mm-dd HH24:MI:SS'), 'CST','GMT')
AND new_time(to_date ('2009-07-29 23:59:59','yyyy-mm-dd HH24:MI:SS'),'CST','GMT')) GROUP BY SC.INCIDENTSM1.OPENED_BY) b
WHERE a.ANALYST = b.ANALYST (+)]
I created two simple date parameters, START and END. I have been trying to figure out how to substitute them for the static dates in the query. I am having trouble figuring out the Oracle date format so I know what I need to replace with the parameters. I have tried both DATE and DATETIME as the value type for the parameters with no success.
Can someone offer some pointers? If I failed to give needed info let me know what it is and I will post it.
Thanks
[select sum(a.OPEN), sum(b.CLOSED) FROM
(Select SC.INCIDENTSM1.OPENED_BY AS ANALYST, Count(*) AS OPEN FROM SC.INCIDENTSM1
WHERE (SC.INCIDENTSM1.Entry_Point = 11) AND
not (SC.INCIDENTSM1.CATEGORY = 'FACILITIES') and
not (SC.INCIDENTSM1.CATEGORY = 'BUILDING SERVICES') and
(SC.INCIDENTSM1.OPEN_TIME BETWEEN new_time(to_date ('2009-07-14 00:00:01', 'yyyy-mm-dd HH24:MI:SS'),'CST','GMT')
AND new_time(to_date ('2009-07-14 23:59:59','yyyy-mm-dd HH24:MI:SS'),'CST','GMT')) GROUP BY SC.INCIDENTSM1.OPENED_BY) a,
(Select SC.INCIDENTSM1.OPENED_BY AS ANALYST, Count(*) AS CLOSED FROM SC.INCIDENTSM1
WHERE (trunc(SC.INCIDENTSM1.CLOSE_TIME) = trunc(SC.INCIDENTSM1.OPEN_TIME))
AND (SC.INCIDENTSM1.CLOSED_BY = SC.INCIDENTSM1.OPENED_BY)
AND (SC.INCIDENTSM1.Entry_Point = 11) AND
not (SC.INCIDENTSM1.CATEGORY = 'FACILITIES') and
not (SC.INCIDENTSM1.CATEGORY = 'BUILDING SERVICES') and
(SC.INCIDENTSM1.OPEN_TIME BETWEEN new_time(to_date ('2009-07-29 00:00:01', 'yyyy-mm-dd HH24:MI:SS'), 'CST','GMT')
AND new_time(to_date ('2009-07-29 23:59:59','yyyy-mm-dd HH24:MI:SS'),'CST','GMT')) GROUP BY SC.INCIDENTSM1.OPENED_BY) b
WHERE a.ANALYST = b.ANALYST (+)]
I created two simple date parameters, START and END. I have been trying to figure out how to substitute them for the static dates in the query. I am having trouble figuring out the Oracle date format so I know what I need to replace with the parameters. I have tried both DATE and DATETIME as the value type for the parameters with no success.
Can someone offer some pointers? If I failed to give needed info let me know what it is and I will post it.
Thanks