【问题标题】:Maximum Number of times we can query an oracle database [closed]我们可以查询oracle数据库的最大次数[关闭]
【发布时间】:2012-02-25 23:44:19
【问题描述】:

我有一段代码如下。

 Select * from abc_table where objectsnames="obj1" or "obj2"......"Obj1000"

查询 1000 个对象。

如果我调用这个查询一万次,oracle 会超时吗?

【问题讨论】:

  • 糟糕,真的吗? 1,000 个or?调用了 10,000 次?您要做什么以及如何创建此查询。一定有更好的办法。
  • 请澄清您的问题...向我们展示此查询的上下文。如何,何时,为什么......

标签: oracle oracle11g


【解决方案1】:

我想你想创建一个对象名称的小表然后加入,比如:

create table objectnames
(
  name varchar2(100)
);

-- populate objectnames
-- could be from a file or another table or whatever
insert into objectnames ... 
commit;

-- query from tables
select a.* 
from abc_table a, objectnames o
where a.objectname = o.name
;

您也可以使用 EXISTS 或 IN 语句,例如

select *
from abc_table
where objectname in (
  select name
  from objectnames
);

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2010-11-17
    • 2014-01-13
    • 2021-08-10
    • 2014-02-18
    • 2014-02-12
    • 2017-04-05
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多