迄今为止网上见到的能让我很好理解ROWNUM的一段话:
Oracle's ROWNUM is a sequence number generator. It always starts with 1. The sequence numbers are assigned to each row as they are selected. So when you say "ROWNUM > 1" , you are implicitly asking oracle to assign rownumbers starting from 2, which it cannot do and so you wouldn't get any rows. For testing, try "ROWNUM >=1" where you are asking the rownum to be assigned from 1 and all the rows will get selected.
Summary: Any condition which involves "ROWNUM" should ask Oracle to start assigning rownumbers starting from "1". All other conditions fail.
Oracle's ROWNUM is a sequence number generator. It always starts with 1. The sequence numbers are assigned to each row as they are selected. So when you say "ROWNUM > 1" , you are implicitly asking oracle to assign rownumbers starting from 2, which it cannot do and so you wouldn't get any rows. For testing, try "ROWNUM >=1" where you are asking the rownum to be assigned from 1 and all the rows will get selected.
Summary: Any condition which involves "ROWNUM" should ask Oracle to start assigning rownumbers starting from "1". All other conditions fail.
博客介绍了Oracle中ROWNUM的相关知识。ROWNUM是序列数生成器,从1开始,为所选每行分配序号。使用“ROWNUM > 1”无法获取行,因为不能从2开始分配;而“ROWNUM >=1”可选中所有行。涉及ROWNUM的条件应从1开始分配序号,否则失败。
871

被折叠的 条评论
为什么被折叠?



