这个exists用法错在哪里?

logzgh 2003-08-22 01:58:15
select employeeId,loginname,employeename
from etime.employee
where employeeid not exists(select employeeid
from etime.employeetoorg
where Orgid = iv_OrgID);

写在存储过程里面,为什么出错,出错信息为
PLS-00103:
出现符号 "EXISTS"在需要下列之一时:inlikebetween

把exists改成in后就可以了。

谢了先!
...全文
32 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
beckhambobo 2003-08-22
  • 打赏
  • 举报
回复
select employeeId,loginname,employeename
from employee a
where not exists(select 1
from employeetoorg
where Orgid = iv_OrgID
and employeeid=a.employeeid);
zjhclf 2003-08-22
  • 打赏
  • 举报
回复
select employeeId,loginname,employeename
from etime.employee
where not exists(select employeeid
from etime.employeetoorg
where Orgid = iv_OrgID);


试试!呵呵
adamdoh 2003-08-22
  • 打赏
  • 举报
回复
首先是语法错,应是where not exists(...)
其次,这样写效率不高,建议如下:
select employeeId,loginname,employeename
from etime.employee
minus
select a.employeeId,loginname,employeename
from etime.employee a,etime.employeetoorg b
where a.employeeid = b.employeeid
and b.Orgid = iv_OrgID;

17,082

社区成员

发帖
与我相关
我的任务
社区描述
Oracle开发相关技术讨论
社区管理员
  • 开发
  • Lucifer三思而后行
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧