Redian新闻
>
Re: 用Servlet显示数据库里的数据,分页的? (答案在这里)
avatar
Re: 用Servlet显示数据库里的数据,分页的? (答案在这里)# Database - 数据库
a*e
1
多谢各位的指点,偶在一个newsgroup得到了一个答案,已经验证过了,
可以用应该还不错,贴出来大家看看,但是里面的实现好象没有在Oral
ce里见过. 麻烦那位帮我解释一下.
/***********
The answer is:
select "what you need" from (
select rownum line, "what you need" from "your table" )
where line between "start of subset" and "end of subset"
.....
E.g.:
select name, firstname from (
select rownum line, name, firstname from names)
where line between 10 and 20
order by name;
/***********************
avatar
B*n
2
rownum is a psudocolumn in the result set, it will only be
incremented after a row has been actually selected (using
all the conditions except the one involving rownum
itself).
What i'm saying is that you cannot directly do a query
like this:
select "what you need" from "your table"
where rownum between 10 and 20;
because you never actully selected anything into the
result set, the rownum will never be greater than 0.
In other words, you want to select something based on the
rownum, while the ro

【在 a*********e 的大作中提到】
: 多谢各位的指点,偶在一个newsgroup得到了一个答案,已经验证过了,
: 可以用应该还不错,贴出来大家看看,但是里面的实现好象没有在Oral
: ce里见过. 麻烦那位帮我解释一下.
: /***********
: The answer is:
: select "what you need" from (
: select rownum line, "what you need" from "your table" )
: where line between "start of subset" and "end of subset"
: .....
: E.g.:

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。