Hi I'm having a problem running this SQL statement below. Can anyone help me?
select outage from outage in class uk.co.servicestatus.bo.PlannedOutage where outage.outageId in ( select MAX(poutage.outageId) FROM uk.co.servicestatus.bo.PlannedOutage poutage where poutage.ticketNo > 0 GROUP BY poutage.ticketNo) and and plannedoutage.po_ou
tage_status='In Progress'
is throwing an Exception as below
14:44:24,906 WARN [JDBCExceptionReporter] SQL Error: 907, SQLState: 42000
14:44:24,906 ERROR [JDBCExceptionReporter] ORA-00907: missing right parenthesis
14:44:24,906 ERROR [JDBCExceptionReporter] Could not execute query
java.sql.SQLException: ORA-00907: missing right parenthesis
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:168)
Looking at the logs as below, I understand that its hibernate is adding an extra ")" in the subquery implicitly before running the SQL on DB. Do you know why its adding or what to do about this?
From logs:
select plannedoutage.po_id as po_id, plannedoutage.po_ticket_no as po_ticke2_, plannedoutage.po_name as po_name from planned_outage plannedoutage where (plannedoutage.po_id in(select MAX(poutage.po_id) from planned_outage poutage) group by poutage.ticketNo)and plannedoutage.po_outage_status='In Progress'
Any help will be well appreciated
thanks in advance
Kamal
|