oracleÖÐrownumµÄÓ÷¨
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
---------- ------ ------------------------------------
Ïà¹ØÎĵµ£º
ת×ÔijµØ,¶Ô×÷ÕߺÜÀ¢¾Î- -!²»ÏþµÃµØÖ·ÁË..
ORACLE¶à±í²éѯÓÅ»¯
ÕâÀïÌṩµÄÊÇÖ´ÐÐÐÔÄܵÄÓÅ»¯,¶ø²»ÊǺǫ́Êý¾Ý¿âÓÅ»¯Æ÷×ÊÁÏ:
²Î¿¼Êý¾Ý¿â¿ª·¢ÐÔÄÜ·½ÃæµÄ¸÷ÖÖÎÊÌâ,ÊÕ¼¯ÁËһЩÓÅ»¯·½°¸Í³¼ÆÈçÏÂ(µ±È»,ÏóË÷ÒýµÈÓÅ»¯·½°¸Ì«¹ý¼òµ¥¾Í²»ÁÐÈëÁË,ºÙºÙ):
Ö´Ðз¾¶:ORACLEµÄÕâ¸ö¹¦ÄÜ´ó´óµØÌá¸ßÁËSQLµÄÖ´ÐÐÐÔÄܲ¢½ÚÊ¡ÁËÄÚ´æµÄʹÓÃ: ......
oracleµÄÌåϵºÜÅÓ´ó£¬ÒªÑ§Ï°Ëü£¬Ê×ÏÈÒªÁ˽âoracleµÄ¿ò¼Ü¡£ÔÚÕâÀ¼òÒªµÄ½²Ò»ÏÂoracleµÄ¼Ü¹¹£¬ÈóõѧÕ߶ÔoracleÓÐÒ»¸öÕûÌåµÄÈÏʶ¡£
¡¡¡¡1¡¢ÎïÀí½á¹¹£¨ÓÉ¿ØÖÆÎļþ¡¢Êý¾ÝÎļþ¡¢ÖØ×öÈÕÖ¾Îļþ¡¢²ÎÊýÎļþ¡¢¹éµµÎļþ¡¢ÃÜÂëÎļþ×é³É£©
¡¡¡¡¿ØÖÆÎļþ£º°üº¬Î¬»¤ºÍÑéÖ¤Êý¾Ý¿âÍêÕûÐԵıØÒªÐÅÏ¢¡¢ÀýÈ磬¿ØÖÆÎļþÓÃÓÚʶ±ðÊý¾ÝÎļ ......
Ò»¡¢PL/SQL³öÏÖµÄÄ¿µÄ
¡¡¡¡½á¹¹»¯²éѯÓïÑÔ(Structured Query
Language£¬¼ò³ÆSQL)ÊÇÓÃÀ´·ÃÎʹØϵÐÍÊý¾Ý¿âÒ»ÖÖͨÓÃÓïÑÔ£¬ËüÊôÓÚµÚËÄ´úÓïÑÔ£¨4GL£©£¬ÆäÖ´ÐÐÌصãÊǷǹý³Ì»¯£¬¼´²»ÓÃÖ¸Ã÷Ö´ÐеľßÌå·½·¨ºÍ;
¾¶£¬¶øÊǼòµ¥µÄµ÷ÓÃÏàÓ¦Óï¾äÀ´Ö±½ÓÈ¡µÃ½á¹û¼´¿É¡£ÏÔÈ»£¬ÕâÖÖ²»¹Ø×¢ÈκÎʵÏÖϸ½ÚµÄÓïÑÔ¶ÔÓÚ¿ª·¢ÕßÀ´ËµÓÐ׿«´óµÄ ......
±¾ÎÄÏêϸµÄ½éÉÜÁËOracleÊý¾Ý¿â½ÏºÃµÄÊ®ÖÖÖØÐÂÆô¶¯²½Öè¡£
¡¡¡¡1. Í£Ó¦ÓòãµÄ¸÷ÖÖ³ÌÐò¡£
¡¡¡¡2. Í£oralceµÄ¼àÌý½ø³Ì:
¡¡¡¡$lsnrctl stop
¡¡¡¡3. ÔÚ¶ÀÕ¼µÄϵͳÓû§Ï£¬±¸·Ý¿ØÖÆÎļþ:
¡¡¡¡SQL>alter database backup controlfile to trace;
¡¡¡¡4. ÔÚ¶ÀÕ¼µÄϵͳÓû§Ï£¬ÊÖ¹¤Çл»ÖØ×÷ÈÕÖ¾Îļþ£¬È·±£µ±Ç°ÒÑÐ޸Ĺýµ ......
1¡¢ÅäÖÃhibernate£º
1.1¡¢ÅäÖÃhibernateµÄ³Ö¾ÃÀàÎļþÖжÔÓ¦µÄ×Ö¶ÎΪbyte[]ÀàÐÍ
2.2¡¢ÅäÖÃhibernateµÄÀàÓ³ÉäÎļþÖжÔÓ¦µÄ×Ö¶ÎtypeΪ
org.springframework.orm.hibernate3.support.BlobByteArray ......