Oracle中为什么where rownum > 3 查找不到数据?
查询表emp中所有数据
select emp_id,rownum from emp
第一步,查询结果,rownum待定
emp_id rownum
1 ? 1
2 ? 2
3 ? 3
4 ?
第二步,现在假设用rownum < 3的条件来过滤
第一行,rownum初始分配为1,满足rownum <3的条件,然后rownum加1
第二行,rownum现在为2,满足 < 3的条件,然后rownum加1
.....
第二步,现在假设用 rownum > 2的条件来过滤
现在看第一行,rownum初始分配为1, 不满足rownum>2的条件,rownum不会加1
第二行,rownum还是1,同样不满足>2的条件
....
所以,最后的查询结果,一条数据也没有
例子,取第3行倒第5行当数据
select * from
(select t.*,rwonum rn
from emp t
where rownum < 5 )
where rn > 3
相关文档:
如果你要把Oracle里的大量数据(80M以上)转移到另外的用户,另外的表空间里。可以用下面介绍的快速转移数据的方法。
一、建新表的方式
create table target_tablename tablespace
target_tablespace_name nologging
pctfree 10 pctused 60
storage(initial 5M next 5M minextents 1
maxextents unlimited pctincr ......
一.资源需要:
至少1024 MB物理内存
1024-2048 需1.5倍的交互空间
2048-8192 需1倍的交互空间
8192- 需0.75倍的交互空间
至少400 MB /tmp 临时目录空间
oracle软件需要1.5 GB 到 3.5 GB 磁盘空间
默认数据库需要1.2 GB
二.查看系统资源相关语 ......
从在Linux上安装Oracle到投入使用才几天,碰到的问题就成百上千的。在使用客户端连接远程Oracle数据库服务器时,出现了listener refused the connection with the following error ora-12519 Listener refused the connection with the following error:ORA-12519, TNS:no appropriate service handler foundThe Connection ......
select * from ( select tb1.rollid from (select r.rollid as rollid from zh1_rool r where r.date_p >=to_date('2009-11-26 23:59:59','yyyy-mm-dd hh24:mi:ss') ) tb1
where tb1.rowid !=
(
select max(tb2.rown) from (select t.rowid as rown,t.lot_number as rollid
from inv.mtl_onh ......
select t.lot_number
from inv.mtl_onhand_quantities_detail t
left join mtl_system_items_b mi
on t.inventory_item_id = mi.inventory_item_id
where mi.segment1 like '101%' and mi.organization_id = 102
group by t.lot_number having count(*)=1 union
select t.lot_number||'x'
......