oracleÖзÖÒ³µÄʵÏÖ·½Ê½.rownumµÄʹÓÃ
¶ÔÓÚ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;£¨¿ÉÒÔÓÃÔÚÏÞÖÆ·µ»Ø¼Ç¼ÌõÊýµÄµØ·½£¬±£Ö¤²»³ö´í£¬È磺ÒþʽÓα꣩
SQL> select rownum,id,name from student where rownum=1;
ROWNUM ID NAME
---------- ------ ---------------------------------------------------
1 200001 ÕÅÒ»
SQL> select rownum,id,name from student where rownum =2;
ROWNUM ID NAME
---------- ------ ---------------------------------------------------
£¨2£©rownum¶ÔÓÚ´óÓÚijֵµÄ²éѯÌõ¼þ
Èç¹ûÏëÕÒµ½´ÓµÚ¶þÐмǼÒÔºóµÄ¼Ç¼£¬µ±Ê¹ÓÃrownum>2ÊDz鲻³ö¼Ç¼µÄ£¬ÔÒòÊÇÓÉÓÚrownumÊÇÒ»¸ö×ÜÊÇ´Ó1¿ªÊ¼µÄαÁУ¬Oracle ÈÏΪrownum> n(n>1µÄ×ÔÈ»Êý)ÕâÖÖÌõ¼þÒÀ¾É²»³ÉÁ¢£¬ËùÒԲ鲻µ½¼Ç¼
SQL> select rownum,id,name from student where rownum >2;
ROWNUM ID NAME
---------- ------ ---------------------------------------------------
ÄÇÈçºÎ²ÅÄÜÕÒµ½µÚ¶þÐÐÒÔºóµÄ¼Ç¼ѽ¡£¿ÉÒÔʹÓÃÒÔϵÄ×Ó²éѯ·½·¨À´½â¾ö¡£×¢Òâ×Ó²éѯÖеÄrownum±ØÐëÒªÓбðÃû£¬·ñÔò»¹ÊDz»»á²é³ö¼Ç¼À´£¬
Ïà¹ØÎĵµ£º
OracleÓëSQL ServerÊÂÎñ´¦ÀíµÄ±È½Ï
ÊÂÎñ´¦ÀíÊÇËùÓдóÐÍÊý¾Ý¿â²úÆ·µÄÒ»¸ö¹Ø¼üÎÊÌ⣬¸÷Êý¾Ý¿â³§É̶¼ÔÚÕâ¸ö·½Ã滨·ÑÁ˺ܴó
¾«Á¦£¬²»Í¬µÄÊÂÎñ´¦Àí·½Ê½»áµ¼ÖÂÊý¾Ý¿âÐÔÄܺ͹¦ÄÜÉϵľ޴ó²îÒì¡£
ÊÂÎñ´¦ÀíÒ²ÊÇÊý¾Ý¿â¹ÜÀíÔ±ÓëÊý¾Ý¿âÓ¦ÓóÌÐò¿ª·¢ÈËÔ±±ØÐëÉî¿ÌÀí½âµÄÒ»¸öÎÊÌ⣬¶ÔÕâ¸öÎÊÌâµÄÊèºö¿ÉÄܻᵼÖÂÓ¦ÓóÌÐòÂß¼´í ......
OracleÊý¾Ý¿âµ¼Èëµ¼³ö£¨1£©
Oracleµ¼Èëµ¼³ö¹Ù·½¶¨Òå
ÈçºÎ²é¿´ImpºÍExpÃüÁ
Ç°Ì᣺°²×°OracleÊý¾Ý¿â»òÕß¿Í»§¶Ë¡£
Ò»¡¢ IMPÃüÁî
1. ´ò¿ªÃüÁîÌáʾ·û¡£ÀýÈ磬£¨Windows XP£© ......
OracleÊý¾Ý¿âµ¼Èë±ÃºÍµ¼³ö±ÃimpdpºÍexpdp£¨1£©
Oracleµ¼Èëµ¼³ö¹Ù·½¶¨Òå
ÈçºÎ²é¿´ImpdpºÍExpdpÃüÁ
Ç°Ì᣺°²×°OracleÊý¾Ý¿â£¨µ¼Èë±ÃºÍµ¼³ö±ÃÖ»ÄÜÔÚOracleÊý¾Ý¿â·þÎñÆ÷¶ËʹÓã©¡£
Ò»¡¢ IMPDPÃüÁî
1.   ......
ÔÚÏàͬ²Ù×÷ϵͳ»·¾³Ï£¬Ïàͬ°æ±¾OracleÊý¾Ý¿âµÄǨÒƱȽϼòµ¥¡£
´óÖ²½Ö裺
1¡¢È·¶¨Ô´»úµÄ²Ù×÷ϵͳÀàÐͺͰ汾£¬Ô´»úÖ÷»úÃû£»Oracle°æ±¾£¬°²×°Ä¿Â¼£¬SID¡£
±¾ÀýÖУ¬Ô´»úΪ£º Win2k Adv£¬ ywxt£¬Oracle v8.17, d:\oracle, orcl
Ä¿±ê»úΪ£ºWin2003£¬ywxt£¬Oracle v8.17, d:\oracle, orcl
......
oracleÊý¾Ý¿âµÄ±¸·ÝÓë»Ö¸´
---- µ±ÎÒÃÇʹÓÃÒ»¸öÊý¾Ý¿âʱ£¬×ÜÏ£ÍûÊý¾Ý¿âµÄÄÚÈÝÊÇ¿É¿¿µÄ¡¢ÕýÈ·µÄ£¬µ«ÓÉÓÚ¼ÆËã»úϵͳµÄ¹ÊÕÏ£¨°üÀ¨»úÆ÷¹ÊÕÏ¡¢½éÖʹÊÕÏ¡¢Îó²Ù×÷µÈ£©£¬Êý¾Ý¿âÓÐʱҲ¿ÉÄÜÔâµ½ÆÆ»µ£¬ÕâʱÈçºÎ¾¡¿ì»Ö¸´Êý¾Ý¾Í³ÉΪµ±ÎñÖ®¼±¡£Èç¹ûƽʱ¶ÔÊý¾Ý¿â×öÁ˱¸·Ý£¬ÄÇô´Ëʱ»Ö¸´Êý¾Ý¾ÍÏԵúÜÈÝÒס£Óɴ˿ɼû£¬×öºÃÊý¾Ý¿âµÄ±¸·ÝÊǶ ......