Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL Max() function to Oracle?

Status
Not open for further replies.

LGTOserv

IS-IT--Management
Aug 20, 2001
25
US
Hi all;

I previously posted an question relating to an MS SQL server query where i needed the Max() of a timestamp field. This was solved by one of the members here. I now have another db which is oracle that i need the same query to work on. For some reason a copy and paste of the query does not work as some of the fields are different. I do have a query that returns all of the fields i need.. below:

select distinct
T1.dbid,
T1.id,
T2.login_name,
T3.callid,
T3.status,
T4.login_name,
T1.headline,
T1.severity,
T1.priority,
T1.submit_date,
T5.action_timestamp
from CQOTG.Defect T1,
CQDB.users T2,
CQDB.gecontactlist T3,
CQDB.parent_child_links T3mm,
CQDB.users T4,
CQDB.history T5,
CQDB.statedef T6
where T1.submitter = T2.dbid
and T1.dbid = T3mm.parent_dbid (+)
and 16779812 = T3mm.parent_fielddef_id (+)
and T3mm.child_dbid = T3.dbid (+)
and T1.owner = T4.dbid
and T1.dbid = T5.entity_dbid
and 16777279 = T5.entitydef_id
and T1.state = T6.id
and (T1.dbid <> 0
and ((T1.mscrtype in ('Escalation')
and T1.mproduct like '%DiskXtender%'
and (T6.name not in ('Closed','Duplicate','Resolved') or T1.state = 0))))


What i am trying to do is take the records returned by this query and get the max() of the T5.action_timestamp field. When i put MAX(T5.action_timestamp) i get the following error:

ORA-00942: table or view does not exist

Does Oracle SQL support the MAX() function? i connect with Microsoft OLEDB for Oracle driver...

thanks in advance..
 
Yes, Oracle supports MAX().
What the error is telling you is (1)CQDB.history table does not exist or (2)the user you are logging into Oracle as does not have permission to see CQDB.history.

To remove the latter problem, log in as CQDB and issue the following:
GRANT SELECT on history TO <the user name you use to log into Oracle>;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top