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
相关文档:
1. Read the Data Block.
2. Read the Row Header.
3. Check the Lock Byte to determine whether there's an ITL entry.
4. Read the ITL entry to determine the Transaction ID (Xid).
5. Read the Transaction Table using the Transaction ID. If the transaction has been committed and has a System Commit ......
那些服务需要启动需要看你自己的需求,详见:
Windows下常见Oracle服务介绍:
(1)OracleServiceSID
数据库服务,这个服务会自动地启动和停止数据库。如果安装了 ......
从在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 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') and rollid not in
(select t.lot_number as rollid
from inv.mtl_onhand_quantities_detail t
left join mtl_system_items_b mi
on t.inventory_item_id = mi.inventory_ ......
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'
......