国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > 綜合 > 正文

如何返回指定行數之間的查詢結果?

2024-07-21 02:09:17
字體:
來源:轉載
供稿:網友
中國最大的web開發資源網站及技術社區,

 
如何返回指定行數之間的查詢結果?


    如何返回指定行數之間的查詢結果,以實現web記錄分頁,在oracle中有許多的方法,這里僅僅列出了4種,希望能對大家有所幫助,大家可以根據不同需要選擇下面的script 

1)select ... where rownum < 50 minus select ... where rownum < 30  
    這個方法因為用到了minus操作符,所以速度會受影響。  

2) 
select results.* from  
( select t2.*, rownum rownumber from  
( select t.* from mv_table t where order by col1) t2) results  
where results.rownumber between 30 and 50 order by col1 

這個方法是從一個論壇上看到的,沒有親自測試過  

3) 
定義cursor x, 2.fetch x a,b,c; loop ...... end loop;  
其中用兩個循環變量和一個flag變量,分別表示,當前的記錄數,屬于第幾頁的, 及第一頁面。  
ps;  
j:=to_number(kafyf);  
i:=1;  
open cx;  
loop fetch cx into col1,col2,col3,col4,col5,col6;  
if cx%notfound then exit; end if;  
    if i>=j then  
htp.tablerowopen;  
htp.tabledata(col1);  
htp.tabledata(col2);  
htp.tabledata(col4);  
htp.tabledata(col5);  
htp.tabledata(col6);  
htp.tabledata(col3);  
htp.tablerowclose;  
i:=i+1;  
if i=j+10 then l:=1; exit; end if;  
else i:=i+1;  
end if;  
end loop;  
close x;  

該方法是名叫‘淼’的網友寫的script,他用到了oracle web2kit中的owa_util package。 

4)how can one page forward and backwards through a table? 
externalize rownum by implementing queries like this:  

select ...  
from (select rownum rnum, ... from ...)  
where rnum between :low and :high and rownum <(:high :low + 1);  

    where :low and :high are dynamically generated values depending on which result page the user 
is viewing. typically, they are used to show "next 15 matches", "previous 15 matches" links at the 
bottom of each page.  
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 常德市| 和田市| 密云县| 定边县| 晋江市| 利津县| 石屏县| 斗六市| 山阴县| 章丘市| 九龙坡区| 庆城县| 精河县| 原平市| 新龙县| 沛县| 新余市| 新巴尔虎左旗| 日喀则市| 恩平市| 五家渠市| 巴彦淖尔市| 金塔县| 乌鲁木齐县| 渝北区| 屯门区| 通州区| 江孜县| 镇安县| 黔西县| 福泉市| 富顺县| 沾化县| 凌源市| 确山县| 文水县| 琼中| 盘锦市| 博客| 博客| 遵义县|