我正在运行的Crystal Report收到错误消息。它说"无法从数据库中检索数据"。然后它也会显示," ORA-01427:单行子查询返回多行"。看起来很直接,但我无法弄清楚。我在报告中内置了一个没有子查询的命令:
SELECT WA.HRORGANIZATION,TRIM(PA.ACTOR) AS "Epass",E.EMPLOYEE,TRIM(E.PRESENTATIONNAMESNAPSHOT),WA.HRORGANIZATIONUNIT,VW.ENTITYORGUNIT,VW.ENTITY
FROM LTMPROD.AGENT AG
LEFT OUTER JOIN LTMPROD.PARENTAGENT PA ON PA.PARENTAGENT = AG.PARENTAGENT
LEFT OUTER JOIN LTMPROD.EMPLOYEE E ON TRIM(AG.KEYTEXT) = TRIM(E.HRORGANIZATION)||', '||TRIM(E.EMPLOYEE)
LEFT OUTER JOIN LTMPROD.WORKASSIGNMENT WA ON WA.EMPLOYEE = E.EMPLOYEE
AND WA.WORKASSIGNMENT = E.PRIMARYWORKASSIGNMENT
LEFT OUTER JOIN LTMPROD.XXX_ORGUNIT_ENTITY_VIEW VW ON VW.HRORGANIZATIONUNIT = WA.HRORGANIZATIONUNIT
WHERE AG.BORBUSINESSCLASSNAME = 'Employee'
AND TRIM(PA.ACTOR) = '{?LAWSONRS_CurrentUser}'
我还在记录选择中建立了一个公式:
if {?LAWSONRS_CurrentUser} = "xyz" then
{JOBPOSTING.PDRBEGIN} in {?Start Date} to {?End Date}
else
{cmdEpass.Epass} = {?LAWSONRS_CurrentUser}
and {XXX_ORGUNIT_ENTITY_VIEW.ENTITYORGUNIT} IN
(
SELECT {cmdEpass.ENTITYORGUNIT}
CASE 606: [606]
CASE 609: [609,610]
CASE 610: [609,610]
CASE 883: [883]
DEFAULT : [0]
)
and
{JOBPOSTING.PDRBEGIN} in {?Start Date} to {?End Date}
这个错误会发生在哪里(对于任何格式化问题感到抱歉)?如果我完全删除公式,报表运行就好了。所以我不认为问题出在命令中。但我仍然希望根据用户Epass进行过滤。
答案 0 :(得分:0)
您的公式返回多个元素。
您可以更改=
IN ( ... )
或者只使用LIMIT 1
选择一行。