ORA-00907: 缺少右括号
SELECT DISTINCT( EMP.EMPLOYEEID ),
EMP.EMPLOYEECODE,
EMP.EMPLOYEENAME,
EMP.HOMEADDRESS,
DESIG.DESIGNATIONNAME
FROM HRM_EMPLOYEE EMP,
COM_DESIGNATION DESIG,
COM_DEPARTMENT DEPT,
COM_COMPANY COMP,
HRM_EMPLOYEEDEPARTMENTS EMPDEPT,
USR_USERS USRS
WHERE EMP.EMPLOYEEID = EMPDEPT.EMPLOYEEID AND
EMP.DESIGNATIONID = DESIG.DESIGNATIONID AND
DESIG.DEPARTMENTID = EMPDEPT.DEPARTMENTID AND
EMP.STATUS IN (SELECT STAT STAT
FROM
(
CASE
When (:status = 0) THEN
SELECT 1 STAT FROM dual
UNION ALL
SELECT 2 STAT FROM dual
else
Select :status STAT from dual
end
)
xx
)
其实我的需求是:根据参数传递来存放记录。如果 tat 参数我希望显示所有记录。
SELECT DISTINCT( EMP.EMPLOYEEID ),
EMP.EMPLOYEECODE,
EMP.EMPLOYEENAME,
EMP.HOMEADDRESS,
DESIG.DESIGNATIONNAME
FROM HRM_EMPLOYEE EMP,
COM_DESIGNATION DESIG,
COM_DEPARTMENT DEPT,
COM_COMPANY COMP,
HRM_EMPLOYEEDEPARTMENTS EMPDEPT,
USR_USERS USRS
WHERE EMP.EMPLOYEEID = EMPDEPT.EMPLOYEEID AND
EMP.DESIGNATIONID = DESIG.DESIGNATIONID AND
DESIG.DEPARTMENTID = EMPDEPT.DEPARTMENTID AND
EMP.STATUS IN (SELECT STAT STAT
FROM
(
CASE
When (:status = 0) THEN
SELECT 1 STAT FROM dual
UNION ALL
SELECT 2 STAT FROM dual
else
Select :status STAT from dual
end
)
xx
)
Actually my need is: stow the records according to the parameter passing. if tat parameter i wish to show all records.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您不能将
CASE
语句用作表表达式(除非使用嵌套表类型)。但为什么这么复杂呢?而不是这样写:写这样:
You cannot have a
CASE
statement as a table expression (unless perhaps if using nested table types). But why so complicated? Instead of this:Write this: