我在hql (Oracle CC&B实用程序框架)中遇到了一个问题
我的SQL查询是
select msg.EXT_MSG_ID, msg.MKTMSG_ID
from O2_IN_CA_MSG msg
where EXT_MSG_ID = (select to_char(max(to_number(msg1.EXT_MSG_ID)))
from O2_IN_CA_MSG msg1, F1_BUS_OBJ_STATUS bostatus
where msg1.BUS_OBJ_CD = bostatus.BUS_OBJ_CD
AND bostatus.BO_STATUS_COND_FLG <> 'F1FL'
AND msg1.BO_STATUS_CD = bostatus.BO_STATUS_CD
AND msg1.BUS_OBJ_CD = 'O2-OESPCusTarIn'
AND msg1.SRC_DOC_ID = '12345678'
AND msg1.MKTMSG_ID <> '179977027857'
AND msg1.acct_id = '7565333022'
)HQL Query1:
FROM InboundCustomerAdminMessage inboundCustomerAdminMessage
WHERE inboundCustomerAdminMessage.externalMessageId =
(TO_CHAR(MAX(TO_NUMBER(inboundCustomerAdminMessage1.externalMessageId)))
FROM InboundCustomerAdminMessage inboundCustomerAdminMessage1, BusinessObjectStatus businessObjectStatus
WHERE inboundCustomerAdminMessage1.businessObject.id = businessObjectStatus.id.businessObject.id
AND businessObjectStatus.condition <> :boStatusCond
AND inboundCustomerAdminMessage1.status = businessObjectStatus.id.status
AND businessObjectStatus.id.businessObject.id = :businessObjectId
AND inboundCustomerAdminMessage1.sourceDocumentId = :srcDocId
AND inboundCustomerAdminMessage1.id <> :mktMsgId )例外是: ORA-00934: group函数在这里是不允许的。
我使用SELECT HQL查询2尝试了第二个查询:
FROM InboundCustomerAdminMessage inboundCustomerAdminMessage
WHERE inboundCustomerAdminMessage.externalMessageId =
(SELECT TO_CHAR(MAX(TO_NUMBER(inboundCustomerAdminMessage1.externalMessageId)))
FROM InboundCustomerAdminMessage inboundCustomerAdminMessage1, BusinessObjectStatus businessObjectStatus
WHERE inboundCustomerAdminMessage1.businessObject.id = businessObjectStatus.id.businessObject.id
AND businessObjectStatus.condition <> :boStatusCond
AND inboundCustomerAdminMessage1.status = businessObjectStatus.id.status
AND businessObjectStatus.id.businessObject.id = :businessObjectId
AND inboundCustomerAdminMessage1.sourceDocumentId = :srcDocId
AND inboundCustomerAdminMessage1.id <> :mktMsgId )这一次的例外是:创建hibernate查询'FROM InboundCustomerAdminMessage inboundCustomerAdminMessage WHERE inboundCustomerAdminMessage.externalMessageId = all (select TO_CHAR(MAX(TO_NUMBER(inboundCustomerAdminMessage1.externalMessageId))) FROM InboundCustomerAdminMessage inboundCustomerAdminMessage1, BusinessObjectStatus businessObjectStatus WHERE inboundCustomerAdminMessage1.businessObject.id = businessObjectStatus.id.businessObject.id AND businessObjectStatus.condition <> :boStatusCond AND inboundCustomerAdminMessage1.status = businessObjectStatus.id.status AND businessObjectStatus.id.businessObject.id = :businessObjectId AND inboundCustomerAdminMessage1.sourceDocumentId = :srcDocId AND inboundCustomerAdminMessage1.id <> :mktMsgId ) '错误
在select中,从com.splwg.domain.mtm.inbound.inboundCustomerAdminMessage.InboundCustomerAdminMessage__ inboundCustomerAdminMessage中选择inboundCustomerAdminMessage.externalMessageId,其中inboundCustomerAdminMessage.externalMessageId = all (从com.splwg.domain.mtm.inbound.inboundCustomerAdminMessage.InboundCustomerAdminMessage__ inboundCustomerAdminMessage1中选择,com.splwg.domain.common.businessObject.BusinessObjectStatus__ businessObjectStatus,其中inboundCustomerAdminMessage1.businessObject.id = businessObjectStatus.id.businessObject.id和businessObjectStatus.condition <> :boStatusCond和in界CustomerAdminMessage1.Status= businessObjectStatus.id.status和businessObjectStatus.id.businessObject.id = :businessObjectId和in联CustomerAdminMessage1.SourceDocumentId= :srcDocId和in界CustomerAdminMessage1.id <> :mktMsgId )
请您帮助任何人如何在hql中使用SELECT子句。
发布于 2016-05-05 11:53:44
删除HQL中的“inboundCustomerAdminMessage.externalMessageId desc订单”
https://stackoverflow.com/questions/32696320
复制相似问题