(ת£©oracleÖеÄrownum
ÔÚ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;£¨¿ÉÒÔÓÃÔÚÏÞÖÆ·µ»Ø¼Ç¼ÌõÊýµÄµØ·½£¬±£Ö¤²»³ö´í£¬È磺ÒþʽÓα꣩
SQL> select rownum,id,name from student where rownum=1;
ROWNUM ID NAME
---------- ------ -------------------------------
Ïà¹ØÎĵµ£º
select nvl2(replace(translate('69584.00.00','.0123456789','000000000000'),'0',''),'·ñ','ÊÇ') IsNumber from dual;
select id,nvl2(replace(translate(id,'.0123456789','000000000000'),'0',''),'·ñ','ÊÇ') IsNumber
from tbl2 ......
=================================================================================
Oracle RAC ²úÆ·¸ÅÊö
Oracle Real Application Server£¬ÕæÕýÓ¦Óü¯Èº£¬¼ò³ÆOracle RAC £¬ÊÇOracleµÄ²¢Ðм¯Èº£¬Î»ÓÚ²»Í¬·þÎñÆ÷ϵͳµÄOracleʵÀýͬʱ·ÃÎÊͬһ¸öOracleÊý¾Ý¿â£¬½ÚµãÖ®¼äͨ¹ý˽ÓÐÍøÂç½øÐÐͨÐÅ£¬ËùÓеĿØÖÆÎļþ¡¢Áª»úÈÕÖ ......
OracleÆô¶¯¹ý³Ì½éÉܼ°ÃüÁ»¹Óйرա£
дÔÚÇ°Ãæ£ºÆô¶¯Êý¾Ý¿âǰ£¬ÇëÏÈÆô¶¯¼à³ÌÐò¡£
lsnrctl start
Æô¶¯µÄÈý¸ö²½Ö裬ÒÀ´ÎΪ1.´´½¨²¢Æô¶¯ÊµÀý¡¢2.×°ÔØÊý¾Ý¿â¡¢3.´ò¿ªÊý¾Ý¿â¡£
¿ÉÒÔͨ¹ýÃüÁîstartupÀ´ÊµÏÖ¡£
startup ÃüÁî¸ñʽ
startup [ nomount | mount | open | force ] [ restrict ] [ pfile=filename ];
·½·¨1 -- st ......
ÕâÆªÎÄÕ²ûÊöÁËÈçºÎ¹ÜÀíoracle ERPµÄinterface±í
ÕâÆªÎÄÕ²ûÊöÁËÈçºÎ¹ÜÀíoracle ERPµÄinterface±í
http://blog.oraclecontractors.com/?p=212
There are a number of tables used by Oracle Applications that should have no rows in them when all is running well, and if any, only a few rows that are in error. ......