【发布时间】:2011-02-16 14:54:36
【问题描述】:
如果记录数超过某个数字 n,则在 varchar2 列的 where 子句中执行 to_number 函数时遇到间歇性问题。我使用了 n ,因为没有确切的记录数量。在一个 DB 上,它发生在 n 为 100 万之后,而另一个 DB 为 0.1。百万。
例如我有一个包含 1000 万条记录的表,比如 Table Country,它的 field1 varchar2 包含数字数据和 Id
如果我以查询为例
select *
from country
where to_number(field1) = 23
and id >1 and id < 100000
这行得通
但如果我进行查询
select *
from country
where to_number(field1) = 23
and id >1 and id < 100001
说无效号码失败
接下来我尝试查询
select *
from country
where to_number(field1) = 23
and id >2 and id < 100001
又可以了
因为我只得到了无效的号码,所以很混乱,但在日志文件中它说
Memory Notification: Library Cache Object loaded into SGA
Heap size 3823K exceeds notification threshold (2048K)
KGL object name :with sqlplan as (
select c006 object_owner, c007 object_type,c008 object_name
from htmldb_collections
where COLLECTION_NAME='HTMLDB_QUERY_PLAN'
and c007 in ('TABLE','INDEX','MATERIALIZED VIEW','INDEX (UNIQUE)')),
ws_schemas as(
select schema
from wwv_flow_company_schemas
where security_group_id = :flow_security_group_id),
t as(
select s.object_owner table_owner,s.object_name table_name,
d.OBJECT_ID
from sqlplan s,sys.dba_objects d
这似乎与SGA大小有关,但谷歌并没有给我太多帮助。
有人对 TO_NUMBER 或大数据的 oracle 函数的这个问题有任何想法吗?
【问题讨论】:
标签: sql oracle oracle10g ora-01722