我有一个查询如下:
SELECT
WAH.ALERT_KEY AS ALERT_KEY,
TRUNC(WAH.EVENT_DATE) AS ALERT_DATE,
WAH.AT_DATASOURCE_ID AS DATA_SOURCE_ID,
WAH.CHECK_DEFINITION_ID AS CHECK_ID,
OU.ID AS ORGUNIT_ID,
USR.ID AS USER_ID,
GRP.ID AS GROUP_ID,
CUS.SOURCE_SYSTEM AS SOURCE_SYTEM
FROM
WLM_ALERT_HEADER WAH,
CHECK_DEFINITION CD,
ORGANIZATION_UNITS OU,
USERS USR,
GROUPS GRP,
CUSTOMERS CUS,
WORKFLOW_WORKITEM WW
WHERE
WAH.ALERT_KEY in (
select
ENTITY_KEY
from
WORKFLOW_WORKITEM ww
where
ww.STATUS_ID in (
select
ID
from
WORKFLOW_STATUSES ws
where
ws.CODE IN (
'S_GE_WLM_WL_001', 'S_GE_WLM_WL_002',
'S_GE_WLM_WL_003', 'S_GE_WLM_WL_004',
'S_GE_WLM_WL_007', 'S_GE_WLM_WL_010'
)
and ww.ORGUNIT_ID in (
select
ou.ID
from
ORGANIZATION_UNITS ou
where
ou.ID = (
select
cus.ORGUNIT_ID
from
CUSTOMERS cus
where
cus.CUSTOMER_ID = wah.CUSTOMER_ID
)
)
)
)
AND WAH.CHECK_DEFINITION_ID = CD.ID
AND USR.ID = WW.ASSIGNED_TO
AND GRP.ID IN (
select
GROUP_ID
from
USER_GROUP_RELATIONS
where
USER_ID = USR.ID
)
AND WW.ENTITY_NAME = 'WLM Alert';
ORA-01722 被抛出上述查询,除非我把这 2 行:
AND WAH.CHECK_DEFINITION_ID = CD.ID
AND USR.ID = WW.ASSIGNED_TO
在子查询 WAH.ALERT_KEY 的右括号内
但是,这不应该是这样,因为这两行不是子查询的一部分。我想知道子查询中的哪个字段抱怨转换失败。