OracleµÄrownumÔÀíºÍʹÓÃ(·ÖÒ³²éѯ)
ÒªÏÔʾ1µ½2ÐÐÔò¿ÉÒÔͨ¹ý
select * from dangan where rownum between 1 and 2
ÔÚOracle
ÖУ¬Òª°´Ìض¨Ìõ¼þ²éѯǰNÌõ¼Ç¼£¬Óøörownum
¾Í¸ã¶¨ÁË¡£
select *
from emp where rownum
<= 5
¶øÇÒÊéÉÏÒ²¸æ½ë£¬²»ÄܶÔrownum
ÓÃ">"£¬ÕâÒ²¾ÍÒâζ×Å£¬Èç¹ûÄãÏëÓÃ
select * from emp
where rownum
> 5
ÔòÊÇʧ°ÜµÄ¡£ÒªÖªµÀΪʲô»áʧ°Ü£¬ÔòÐèÒªÁ˽ârownum
±³ºóµÄ»úÖÆ£º
1 Oracle
executes your query.
2 Oracle
fetches the first row and calls it row number 1.
3 Have we gotten past row number meets the criteria? If no, then
Oracle
discards the row, If yes, then Oracle
return
the row.
4 Oracle
fetches the next row and advances the row number (to 2,
and then to 3, and then to 4, and so forth).
5 Go to step 3.
Á˽âÁËÔÀí£¬¾ÍÖªµÀrownum
>²»»á³É¹¦£¬ÒòΪÔÚµÚÈý²½µÄʱºò²éѯ³öµÄÐÐÒѾ±»¶ªÆú£¬µÚËIJ½²é³öÀ´µÄrownum
ÈÔÈ»ÊÇ1,ÕâÑùÓÀÔ¶Ò²²»»á³É¹¦¡£
ͬÑùµÀÀí£¬rownum
Èç¹ûµ¥¶ÀÓÃ=,Ò²Ö»ÓÐÔÚrownum
=1ʱ²ÅÓÐÓá£
¶ÔÓÚrownum
À´ËµËüÊÇoracle
ϵͳ˳Ðò·ÖÅäΪ´Ó²éѯ·µ»ØµÄÐеıàºÅ£¬·µ»ØµÄµÚÒ»ÐзÖÅäµÄÊÇ1£¬µÚ¶þÐÐÊÇ2£¬ÒÀ´ËÀàÍÆ£¬Õâ¸öα×ֶοÉÒÔÓÃÓÚÏÞÖƲéѯ·µ»ØµÄ×ÜÐÐÊý£¬¶øÇÒrownum
²»ÄÜÒÔÈκαíµÄÃû³Æ×÷Ϊǰ׺¡£
¾ÙÀý˵Ã÷£º
ÀýÈç±í£ºstudent(ѧÉú)±í£¬±í½á¹¹Îª£º
ID¡¡¡¡¡¡
char(6)¡¡¡¡¡¡¡¡¡¡ --ѧºÅ
name¡¡¡¡¡¡¡¡VARCHAR2(10)¡¡¡¡¡¡--ÐÕÃû
create table student (ID
char(6), name VARCHAR2(100));
insert into sale
values('200001',‘ÕÅÒ»’);
insert into sale values('200002',‘Íõ¶þ’);
insert into
sale values('200003',‘ÀîÈý’);
insert into sale
values('200004',‘ÕÔËÄ’);
commit;
(1) rownum
¶ÔÓÚµÈÓÚijֵµÄ²éѯÌõ¼þ
Èç¹ûÏ£ÍûÕÒµ½Ñ§Éú±íÖеÚÒ»ÌõѧÉúµÄÐÅÏ¢£¬¿ÉÒÔʹÓÃrownum
=1×÷ΪÌõ¼þ¡£µ«ÊÇÏëÕÒµ½Ñ§Éú±íÖеڶþÌõѧÉúµÄÐÅÏ¢£¬Ê¹ÓÃrownum
=2½á¹û²é²»µ½Êý¾Ý¡£ÒòΪrownum
¶¼ÊÇ´Ó1¿ªÊ¼£¬µ«ÊÇ1ÒÔÉϵÄ×ÔÈ»ÊýÔÚrownum
×öµÈÓÚÅжÏÊÇʱÈÏΪ¶¼ÊÇfalseÌõ¼þ£¬ËùÒÔÎÞ·¨²éµ½rownum
= n£¨n>1µÄ×ÔÈ»Êý£©¡£
SQL> select rownum
,id,name from student
where rownum
=1;£¨¿ÉÒÔÓÃÔÚÏÞÖÆ·µ»Ø¼Ç¼ÌõÊýµÄµØ·½£¬±£Ö¤²»³ö´í£¬È磺ÒþʽÓαê£
Ïà¹ØÎĵµ£º
http://www.diybl.com/course/3_program/java/javajs/2008429/111906.html
Èç¹ûҪʹÓóصĻ°,¾Í±ØÐëʹÓÃOracleConnectionCacheImpl,¹²ÓÐÈýÖֳصIJßÂÔ:
DYNAMIC_SCHEME(ÊǶ¯Ì¬Ôö¼Ó.ÓÃÍêÈç¹û³¬¹ýÉÏÏÞÔò¹Øµô)
The cache will create connections above the specified maximum limit
when necessary but ......
Ò».ÎïÀí¶Á(physical read)
µ±Êý¾Ý¿éµÚÒ»´Î¶ÁÈ¡µ½,¾Í»á»º´æµ½buffer cache ÖÐ,¶øµÚ¶þ´Î¶ÁÈ¡ºÍÐ޸ĸÃÊý¾Ý¿éʱ¾ÍÔÚÄÚ´æbuffer cache ÁË ÒÔÏÂÊÇÀý×Ó:
1.1 µÚÒ»´Î¶ÁÈ¡:
C:"Documents and Settings"Paul Yi>sqlplus "/as sysdba"
SQL*Plus: Release 9.2.0.4.0 - Production on Thu Feb 28 09:32:04 2008
Copyright (c) 19 ......
ÒÔ ÏÂÆßÖÖÊý¾Ýµ¼Èë·½·¨Äĸö×îÊÊÓÃÐèÒªÕë¶Ô¾ßÌåÇé¿ö¾ßÌå·ÖÎö£¬ÎÒÒ²¸½´øÁоÙÁËÓ°Ïìµ¼ÈëËٶȵĸ÷ÖÖÒòËع©Õå×á£ÎªÁ˱Ƚϸ÷ÖÖÊý¾Ýµ¼Èë·½·¨µÄЧ¹û£¬ÎÒ´´½¨ÁËʾÀý±í ºÍÊý¾Ý¼¯£¬²¢Óø÷ÖÖ·½·¨µ¼ÈëʾÀýÊý¾Ý¼¯À´¼ÆËã×ÜÌåµ¼Èëʱ¼äºÍµ¼Èë½ø³ÌÕ¼Óà CPU ʱ¼ä£¬ÕâÀïµÃ³öµÄʱ¼ä½ö¹©²Î¿¼¡£ÐèҪ˵Ã÷µÄÊÇ£¬½¨ÒéÄãʹÓà Oracle 9i ÆóÒµ°æÊý¾Ý¿â£¬ ......
Q1.ÔõÑù´´½¨±í£¿
Q2.ÔõÑùɾ³ý±í£¿
Q3.ÔõÑù´´½¨ÊÓͼ£¿
Q4.ÔõÑùɾ³ýÊÓͼ£¿
Q5.ÔõÑù¸ø±íÌí¼Ó×ֶΣ¿
Q6.ÔõÑùɾ³ý±íÖÐij¸ö×ֶΣ¿
Q7.ÔõÑù¸øij¸ö×Ö¶ÎÌí¼ÓÔ¼Êø£¿
Q8.ÔõÑùÈ¥³ýij¸ö×Ö¶ÎÉϵÄÔ¼Êø£¿
Q9.ÔõÑù¸ø±í¼ÓÉÏÖ÷¼ü£¿
Q10.ÔõÑùɾ³ý±íµÄÖ÷¼ü£¿
Q11.ÔõÑù¸ø±íÌí¼ÓÒ»¸öÍâ¼ü£¿
......
±¾»úµçÄÔÉÏÓа²×°ORACLE10GµÄ¿Í»§¶Ë£¬ºóÀ´ÓÉÓÚÐèÒªÍæÁËÒ»ÏÂODAC£¬ºóÀ´ÓÖжÔصôÁË¡£½á¹û£¬Ê¹ÓÃC#½øÐÐÁ¬½ÓµÄʱºò±¨£º
δÔÚ±¾µØ¼ÆËã»ú×¢²á“OraOLEDB.Oracle.1”Ìṩ³ÌÐò
È»ºó£¬Ð½¨Ò»¸öUDL½øÐвâÊÔ£¬·¢ÏÖOracle Provider & ......